+ Reply to Thread
Results 1 to 7 of 7

VBA If Then with multiple actions

  1. #1
    Registered User
    Join Date
    03-30-2017
    Location
    Sacramento, CA
    MS-Off Ver
    Windows 7
    Posts
    6

    VBA If Then with multiple actions

    Hi! New to VBA. I've done this successfully with Formula in cell, but circumstances of normal use cause the formula to be erased. So, I'd like to use VBA to accomplish it. (OR, if someone knows how to write a formula in one cell that actually acts upon a different cell???)

    I'm trying to write macro that will copy/paste several cells to others of the same size, ONLY IF an unrelated cell holds a certain content. I've tried as a single action:

    Please Login or Register  to view this content.
    And also as separate actions:

    Please Login or Register  to view this content.
    And listed them as cells:

    Please Login or Register  to view this content.
    Completely at a loss as to what's wrong. I'm not close enough for the debugger to tell me what I'm doing wrong. Any help would be greatly appreciated.

    ~Karena
    Last edited by KarenaBena; 06-16-2017 at 02:01 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA If Then with multiple actions

    Moderation removed.
    Last edited by Winon; 06-16-2017 at 02:05 PM. Reason: Code Tags added
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    03-30-2017
    Location
    Sacramento, CA
    MS-Off Ver
    Windows 7
    Posts
    6

    Re: VBA If Then with multiple actions

    So sorry! Thanks for instruction

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: VBA If Then with multiple actions

    AFAIK you cannot copy irregular shaped ranges - so you'll have to copy twice

    Please Login or Register  to view this content.
    Your second sample should have worked...

    I'm not close enough for the debugger to tell me what I'm doing wrong
    You never did mention if it doesn't not work, doesn't work work as you expect or errors.
    Last edited by cytop; 06-16-2017 at 02:19 PM.

  5. #5
    Forum Contributor
    Join Date
    10-13-2012
    Location
    Southern California
    MS-Off Ver
    Excel 2007
    Posts
    401

    Re: VBA If Then with multiple actions

    This format also should work:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-30-2017
    Location
    Sacramento, CA
    MS-Off Ver
    Windows 7
    Posts
    6

    Re: VBA If Then with multiple actions

    Thank you both, Ed and Cytop, for the input. Neither worked. I appreciate the instruction on irregular shaped ranges... hadn't thought of that, and I'm sure it was one of the problems. I don't get an error of any kind, it simply doesn't work.(neither of the formats, nor any that I had tried originally). Certainly perplexing. Is there a way to get this out of VBA, and apply a formula to a cell when it's written in a different cell? For example, where the code would be hidden in any unrelated cell, perhaps L18:
    Please Login or Register  to view this content.
    There would need to be something different at the beginning obviously, other than the "=IF(..." I have no idea how to do that, or whether it's even possible.

  7. #7
    Registered User
    Join Date
    03-30-2017
    Location
    Sacramento, CA
    MS-Off Ver
    Windows 7
    Posts
    6

    Re: VBA If Then with multiple actions

    Thanks so much for the attempts. So confused as to why none of this worked.... I'm sure it's something I'm doing. Anyway, I appreciate your time, both of you. Enjoy the rest of your week!

+ 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 Not Is Nothing multiple actions
    By Aaron092 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2014, 06:33 AM
  2. [SOLVED] Multiple Actions with an IF Statement
    By HangMan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-14-2013, 12:03 PM
  3. [SOLVED] If Then statements with multiple Then actions to take.
    By joshua.p.m. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2012, 12:58 AM
  4. FORMULA Requiring Multiple Actions
    By mistytreasure in forum Excel General
    Replies: 3
    Last Post: 05-31-2011, 11:38 AM
  5. VBA process for multiple actions
    By KarenW in forum Excel General
    Replies: 5
    Last Post: 07-17-2009, 02:08 PM
  6. [SOLVED] perform multiple actions in an IF
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-06-2005, 09:06 AM
  7. [SOLVED] Performing actions on multiple worksheets
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2005, 11:06 AM

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