+ Reply to Thread
Results 1 to 6 of 6

IF statement macro

  1. #1
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    IF statement macro

    I want to use a macro in place of an IF function.

    I have numerical values in Columns A and B. My IF statment located in Column C is =IF(A=0, B*.05, " ") i.e., if A is 0, multiply B by .05, otherwise, leave blank.
    Last edited by Sgligori; 11-05-2014 at 10:17 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,621

    Re: IF statement macro

    This goes in the sheet module:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: IF statement macro

    So why do you need macro? Your formula appears to do what you want

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,621

    Re: IF statement macro

    So why do you need macro? Your formula appears to do what you want
    I would guess the OP is trying to avoid rows with a formula in column C but no data in column A or B.

    The Worksheet Change event handler will put the formula in column C if data is entered in column A or column B.

    Just a guess though

    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: IF statement macro

    Thanks, TMS!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,621

    Re: IF statement macro

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] IF statement to run macro and looping macro
    By Phiabell in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2012, 03:13 PM
  2. If statement in macro
    By punter in forum Excel General
    Replies: 3
    Last Post: 06-20-2006, 07:23 AM
  3. [SOLVED] Macro If Statement
    By Mark64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2006, 07:15 PM
  4. [SOLVED] IF statement in a macro
    By iamn94 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2005, 11:06 PM
  5. F4 key calling Macro instead of Macro's last statement.
    By astrodabu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2005, 12:13 PM

Tags for this Thread

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