Advertisement
AlanElston

ImmediatelySeeMyStringVeryBallGermanTesties

Nov 26th, 2018
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit ' http://www.eileenslounge.com/viewtopic.php?f=30&t=31260
  2. ' **This code must be run from the VB Editor**
  3. Sub ImmediatelySeeImmediate()
  4.  Application.SendKeys Keys:="^g" ' Or manually, **when in the VB Editor**, Hit  Ctrl+g
  5. DoEvents: DoEvents
  6. Dim StrVeryErhBall As String
  7.  
  8. ' Correct strings...
  9. Debug.Print "Correct strings..."
  10.  Let StrVeryErhBall = "=IF(AND(A15="""",B15=""""),"""",""" & "testie" & """)"
  11.  Debug.Print StrVeryErhBall
  12.  Let StrVeryErhBall = "=IF(AND(A15="""",B15=""""),"""",""testie"")"
  13.  Debug.Print StrVeryErhBall
  14. Dim RngHey15 As Range
  15.  Set RngHey15 = Range("A15")
  16.  Let StrVeryErhBall = "=IF(AND(" & RngHey15.Address(rowabsolute:=False, columnabsolute:=False) & "="""",B15=""""),"""",""" & "testie" & """)"
  17.  Debug.Print StrVeryErhBall
  18. Debug.Print:
  19. ' Range values   .Value    .Formula      .Formulalocal
  20. Debug.Print "Range  ""values"""
  21.  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
  22.  
  23.  Let RngHey15.Value = "Somefink": Range("B15").Value = "Somefink Else"
  24.  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
  25.  DoEvents: DoEvents
  26.  Debug.Print "Range(""C15"").Value   is       " & Range("C15").Value
  27.  Debug.Print "Range(""C15"").Formula  is      " & Range("C15").Formula & vbCrLf & "Range(""C15"").Formulalocal is   " & Range("C15").FormulaLocal
  28.  Debug.Print
  29.  
  30. ' Bad strings...
  31. Debug.Print "Bad strings..."
  32.  Let StrVeryErhBall = "=IF(AND(" & "RngHey15.Address(rowabsolute:=False, columnabsolute:=False)" & "="""",B15=""""),"""",""" & "testie" & """)"
  33.  Debug.Print StrVeryErhBall
  34.  Let StrVeryErhBall = "=IF(AND(" & RngHey15.Address(rowabsolute:=False, columnabsolute:=False) & "="",B15=""""),"""",""" & "testie" & """)"
  35.  Debug.Print StrVeryErhBall
  36.  
  37. '_-----------------------------------------------------------
  38. On Error GoTo Bed
  39. Application.Wait (Now + TimeValue("0:00:10"))
  40. Application.OnTime earliesttime:=Now, procedure:="ClearImmediateWindow"
  41. Application.OnTime earliesttime:=Now + TimeValue("0:00:01"), procedure:="TraSh_it"
  42. Exit Sub
  43. Bed:
  44.  MsgBox prompt:="Good night"
  45. End Sub
  46. Public Sub ClearImmediateWindow()
  47.  Application.SendKeys "^g ^a {DEL}"
  48. End Sub
  49. Public Sub TraSh_it()
  50.  On Error Resume Next
  51.  Application.VBE.Windows("Immediate").Close ' English Excel
  52. Application.VBE.Windows("Direktbereich").Close ' German Excel
  53. 'Application.VBE.Windows("§$?*?#$§%").Close ' HindDuWolly Excel
  54. ' On Error GoTo 0
  55. End Sub
  56. '
  57. '
  58. '
  59. '
  60. ' https://www.excelcampus.com/vba/vba-immediate-window-excel/
  61. ' 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