+ Reply to Thread
Results 1 to 5 of 5

IF Formula using VBA

  1. #1
    Registered User
    Join Date
    04-22-2013
    Location
    Worthing, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    IF Formula using VBA

    Hi All,
    im having problems using VBA to insert an IF formula,
    im running a code all using relitive references and i'd like to every time the macro runs to add a new action it adds the IF formula so i dont need to drag it down all the time. I need it to insert a word depending on if an action is overdue, pending insert that word.

    This is the IF formula used in excel

    Please Login or Register  to view this content.
    But i need it to change K3 depending on which row is active if thats makes sense?

    so how do i get VBA to add a formula or drag it down like you would normally to change the cells to K3, K4, K5 etc?

    any help would be great, thanks!

    My whole sheet is designed to insert actions using a userform, whole code below if thats helpful to see what im trying to do:
    Please Login or Register  to view this content.
    Last edited by danmarson; 04-22-2013 at 06:28 AM.

  2. #2
    Registered User
    Join Date
    09-02-2009
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: IF Formula using VBA

    Assuming the IF formula is going on the same line as all the others (not sure from your main code example as it doesn't seem to feature) you could replace the row identifiers in the formula string with the following:

    Please Login or Register  to view this content.
    To give:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-02-2009
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: IF Formula using VBA

    Alternatively you could use the Range.AutoFill method

  4. #4
    Registered User
    Join Date
    04-22-2013
    Location
    Worthing, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: IF Formula using VBA

    spot on thank you, for anyone else googling i used

    Please Login or Register  to view this content.
    many thanks again!

  5. #5
    Registered User
    Join Date
    09-02-2009
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: IF Formula using VBA

    Glad it worked

+ 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