Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Test Coloured Code
Thanks Thanks: 0 Likes Likes: 0

  1. #21
    MrExcel MVP ZVI's Avatar
    Join Date
    Apr 2008
    Location
    Sevastopol
    Posts
    3,640
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Test Coloured Code

    Quote Originally Posted by Peter_SSs View Post
    v2.3

    Code:
    Sub X()
    'NOT HERE!!!
    Dim s As String
    
    s = "abc"
    s = Replace(s, "b", "zzz#yyy")
    End Sub
    I like being able to turn off the MsgBox
    I hated that MsgBox when testing
    Vladimir Zakharov

  2. #22
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Test Coloured Code

    2.4 Module

    Code:
    Option Explicit
    
    Sub x()
    'NOT HERE!!!
    Dim s As String, x As Long '<- Declare here
    
    x = 2
    If x < 3 Then x = x * 5
    s = "abc"
    s = Replace(s, "b", "zzz" & "<" & "body>yyy")
    End Sub
    
    Sub Toggle_Events()
      If Application.EnableEvents Then
        Application.EnableEvents = False
        ActiveWindow.Zoom = 100 'or whatever you want
      Else
        Application.EnableEvents = True
      End If
    End Sub
    
    ' NOTE: Separating "<" in string parts is for correct forum posting
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  3. #23
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Test Coloured Code

    previous 'worked' but I probably wouldn't use it. If I wanted to post that code I would probably just use all black text with the problem < sign replaced by & l t ;
    Code:
    Option Explicit
    
    Sub x()
    'NOT HERE!!!
    Dim s As String, x As Long '<- Declare here
    
    x = 2
    If x < 3 Then x = x * 5
    s = "abc"
    s = Replace(s, "b", "zzz<body>yyy")
    End Sub
    
    Sub Toggle_Events()
      If Application.EnableEvents Then
        Application.EnableEvents = False
        ActiveWindow.Zoom = 100 'or whatever you want
      Else
        Application.EnableEvents = True
      End If
    End Sub
    How is this after editing?
    Still good

    or ...
    Last edited by Peter_SSs; Oct 10th, 2019 at 03:08 AM.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  4. #24
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Test Coloured Code

    .. leave the problem < sign as it is and turn off HTML for this particular post

    Code:
    Option Explicit
    
    Sub x()
    'NOT HERE!!!
    Dim s As String, x As Long '<- Declare here
    
    x = 2
    If x < 3 Then x = x * 5
    s = "abc"
    s = Replace(s, "b", "zzz<body>yyy")
    End Sub
    
    Sub Toggle_Events()
      If Application.EnableEvents Then
        Application.EnableEvents = False
        ActiveWindow.Zoom = 100 'or whatever you want
      Else
        Application.EnableEvents = True
      End If
    End Sub
    Still OK after editing this way too
    Last edited by Peter_SSs; Oct 10th, 2019 at 03:08 AM.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  5. #25
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Test Coloured Code

    Quote Originally Posted by Peter_SSs View Post
    .. leave the problem < sign as it is and turn off HTML for this particular post

    Code:
    Option Explicit
    
    Sub x()
    'NOT HERE!!!
    Dim s As String, x As Long '<- Declare here
    
    x = 2
    If x < 3 Then x = x * 5
    s = "abc"
    s = Replace(s, "b", "zzzyyy")
    End Sub
    
    Sub Toggle_Events()
      If Application.EnableEvents Then
        Application.EnableEvents = False
        ActiveWindow.Zoom = 100 'or whatever you want
      Else
        Application.EnableEvents = True
      End If
    End Sub
    Still OK after editing this way too
    If the last 2 play up when somebody quotes the code, that's their problem as far as I'm concerned.
    Last edited by Peter_SSs; Oct 10th, 2019 at 03:11 AM.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  6. #26
    MrExcel MVP ZVI's Avatar
    Join Date
    Apr 2008
    Location
    Sevastopol
    Posts
    3,640
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Test Coloured Code

    Separating "<" is useful for casual user, I think.
    With & l t; it looks better of course, but it requires some knowledge and has limitations.
    Vladimir Zakharov

  7. #27
    MrExcel MVP ZVI's Avatar
    Join Date
    Apr 2008
    Location
    Sevastopol
    Posts
    3,640
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Test Coloured Code

    Quote Originally Posted by Peter_SSs View Post
    If the last 2 play up when somebody quotes the code, that's their problem as far as I'm concerned.
    Vladimir Zakharov

  8. #28
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Test Coloured Code

    2.5 procedure

    Code:
    Sub x()
    'NOT HERE!!!
    Dim s As String, x As Long '<- Declare here
    
    x = 2
    If x < 3 Then x = x * 5
    s = "abc"
    s = Replace(s, "b", "zzz" & "<" & "body>yyy")
    End Sub
    
    ' NOTE: Separating "<" in string parts is for correct forum posting
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •