Consulting

Results 1 to 4 of 4

Thread: condition error

  1. #1

    condition error

    I'm getting error 13 on this line, but I don't know why. do you know what to change.

    If IsEmpty(Range("G:G")) Or Range("G:G").Value = 0 And Range("H:H").Value = False Then
    Last edited by Aussiebear; 04-16-2023 at 04:07 PM. Reason: Adjusted the code tags

  2. #2
    maybe you need to test each Cell on the range?

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    I'm getting error 13 on this line, but I don't know why. do you know what i need to change.
    Don't think you can test an entire column like that

    This works

    Option Explicit
    
    Sub test()
    If IsEmpty(Range("G1:G1")) Or Range("G1:G1").Value = 0 And Range("H1:H1").Value = False Then
       MsgBox 1
       Else
       MsgBox 2
    End If
    End Sub
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,057
    Location
    Due to lack of interest in this thread by RuneDefour, I am going to close it.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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