+ Reply to Thread
Results 1 to 6 of 6

Use VBA for IF instead of Excel?

  1. #1
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Use VBA for IF instead of Excel?

    Hi,

    Is it possible to use VBA for an IF function? I have a file and in column A I have this formula =IF(N2>"","Test"). So basically, if there is nothing in N2, there is nothing in column A, otherwise put in the word "Test".

    My problems is that that formula is copied down 10,000 times so if I need to print or upload this file to 3rd party software, even though it's blank, it tries to read/print that formula.

    I would like to make a simple script in VBA and tie it to a command button so that if N2 is blank A2 is Blank all the way to N10001 otherwise Test so that there really is no data in those cells and it doesn't mess up printing or file uploads.

    Is this possible?

    Thanks,
    Last edited by Rick-O-Shay; 07-13-2020 at 06:52 PM.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Use VBA for IF instead of Excel?

    Assuming the values in Column N are constants (that is, not formulas), does this macro do what you want...
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: Use VBA for IF instead of Excel?

    Hmm, I just get error 400

  4. #4
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: Use VBA for IF instead of Excel?

    Attaching a sample workbook.

    It just throws an errors with 400.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Use VBA for IF instead of Excel?

    Argh! I made a last minute change and screwed it up! Try this instead...
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: Use VBA for IF instead of Excel?

    That is exactly what I needed! Thanks!!

+ 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