Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit ' http://www.eileenslounge.com/viewtopic.php?f=30&t=31260
- ' **This code must be run from the VB Editor**
- Sub ImmediatelySeeImmediate()
- Application.SendKeys Keys:="^g" ' Or manually, **when in the VB Editor**, Hit Ctrl+g
- DoEvents: DoEvents
- Dim StrVeryErhBall As String
- ' Correct strings...
- Debug.Print "Correct strings..."
- Let StrVeryErhBall = "=IF(AND(A15="""",B15=""""),"""",""" & "testie" & """)"
- Debug.Print StrVeryErhBall
- Let StrVeryErhBall = "=IF(AND(A15="""",B15=""""),"""",""testie"")"
- Debug.Print StrVeryErhBall
- Dim RngHey15 As Range
- Set RngHey15 = Range("A15")
- Let StrVeryErhBall = "=IF(AND(" & RngHey15.Address(rowabsolute:=False, columnabsolute:=False) & "="""",B15=""""),"""",""" & "testie" & """)"
- Debug.Print StrVeryErhBall
- Debug.Print:
- ' Range values .Value .Formula .Formulalocal
- Debug.Print "Range ""values"""
- Let Range("C15").Value = StrVeryErhBall ' The default displayed, "seen" and "written" property is value, so this canbe used to "put in" a formula, just as if you wrote it manually
- Let RngHey15.Value = "Somefink": Range("B15").Value = "Somefink Else"
- MsgBox prompt:="Formula in cell is " & vbCrLf & Range("C15").Formula & vbCrLf & vbCrLf & "If you put that in a cell or inside Evaluate("" "") , then you get" & vbCrLf & Application.Evaluate(StrVeryErhBall) & vbCrLf & vbCrLf & "Note also, the formula in the local language is" & vbCrLf & Range("C15").FormulaLocal
- DoEvents: DoEvents
- Debug.Print "Range(""C15"").Value is " & Range("C15").Value
- Debug.Print "Range(""C15"").Formula is " & Range("C15").Formula & vbCrLf & "Range(""C15"").Formulalocal is " & Range("C15").FormulaLocal
- Debug.Print
- ' Bad strings...
- Debug.Print "Bad strings..."
- Let StrVeryErhBall = "=IF(AND(" & "RngHey15.Address(rowabsolute:=False, columnabsolute:=False)" & "="""",B15=""""),"""",""" & "testie" & """)"
- Debug.Print StrVeryErhBall
- Let StrVeryErhBall = "=IF(AND(" & RngHey15.Address(rowabsolute:=False, columnabsolute:=False) & "="",B15=""""),"""",""" & "testie" & """)"
- Debug.Print StrVeryErhBall
- '_-----------------------------------------------------------
- On Error GoTo Bed
- Application.Wait (Now + TimeValue("0:00:10"))
- Application.OnTime earliesttime:=Now, procedure:="ClearImmediateWindow"
- Application.OnTime earliesttime:=Now + TimeValue("0:00:01"), procedure:="TraSh_it"
- Exit Sub
- Bed:
- MsgBox prompt:="Good night"
- End Sub
- Public Sub ClearImmediateWindow()
- Application.SendKeys "^g ^a {DEL}"
- End Sub
- Public Sub TraSh_it()
- On Error Resume Next
- Application.VBE.Windows("Immediate").Close ' English Excel
- Application.VBE.Windows("Direktbereich").Close ' German Excel
- 'Application.VBE.Windows("§$?*?#$§%").Close ' HindDuWolly Excel
- ' On Error GoTo 0
- End Sub
- '
- '
- '
- '
- ' https://www.excelcampus.com/vba/vba-immediate-window-excel/
- ' https://social.msdn.microsoft.com/Forums/office/en-US/da87e63f-676b-4505-adeb-564257a56cfe/vba-to-clear-the-immediate-window?forum=exceldev
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement