+ Reply to Thread
Results 1 to 6 of 6

IF Then in VBA

  1. #1
    Registered User
    Join Date
    01-09-2016
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    4

    Question IF Then in VBA

    Hi guys,

    I've made a excel sheet with several macro's in VBA.

    I'd like to add a test before the document is saved automatically to PDF.
    Please Login or Register  to view this content.
    If it appears that the value of the second column of the test (Vlookup) is empty then I'd like Excel to do nothing, otherwisde I'd like it to execute the function.
    The way I wrote the code doesn't work.

    Hope someone can help me with this.

    Thanks in advance!

    Kind regards,

    Wesley
    Last edited by wesleyu; 01-10-2016 at 12:09 PM.

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: IF Then in VBA

    then try using
    End Sub in place of 'do nothing
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: IF Then in VBA

    then try using
    End Sub in place of 'do nothing
    That is incorrect. @wesleyu, can you be more specific on what you are trying to test for in this line
    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  4. #4
    Registered User
    Join Date
    01-09-2016
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    4

    Re: IF Then in VBA

    @Hemesh and stnkynts, thanks for your reactions!

    Vlookup is going to find a cell according cell D14. I'd like to test if the cell that Vlookup finds is empty ("").

  5. #5
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: IF Then in VBA

    you could use
    Msgbox "Vlookup has found an Empty cell"

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: IF Then in VBA

    you could use
    Msgbox "Vlookup has found an Empty cell"
    Again also incorrect. @wesleyu I need you to be more specific on what you are trying to do (your previous response was still very vague). Odds are that there is a better way to do it than a vlookup in code and unfortunately I cannot trust that your formula is correct since you said "The way I wrote the code doesn't work". Be very specific on your next post or this will be my last response.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1