+ Reply to Thread
Results 1 to 10 of 10

Copy value of cell d22 to e22 based on value in cell d22

  1. #1
    Registered User
    Join Date
    09-22-2014
    Location
    Wellingborough, England
    MS-Off Ver
    Microsoft Office 2016 Professional
    Posts
    49

    Copy value of cell d22 to e22 based on value in cell d22

    Hi All,

    I need the value of Cell $E22 to equal the value of Cell $D22 if certain criteria are met ...

    How can I convert this formula into a VBA macro?

    =IF(OR($D22="Long Term Sick",$D22="Maternity Leave",$D22="Left the Business"),$D22,"")

    I would like this macro to work on rows $D22:$D221


    Any help or suggestions would be appreciated

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Try, not in module, in Worksheet_Change Event

    Please Login or Register  to view this content.
    Kind regards
    Leo

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Another option
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-22-2014
    Location
    Wellingborough, England
    MS-Off Ver
    Microsoft Office 2016 Professional
    Posts
    49

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Thanks Leo,

    Tried your suggestion but it didn't seem to work ....

    Maybe I did something wrong?

  5. #5
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Think you put code @ wrong place

    try in this exemple


    Kind regards
    Leo
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-22-2014
    Location
    Wellingborough, England
    MS-Off Ver
    Microsoft Office 2016 Professional
    Posts
    49

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Hi Fluff13,

    Had more success with your suggestion.

    I changed the value of the Target .Offset from 1 to 84 as I need to copy a value from the array to Cell CJ22 not E22 and that works fine.

    Your help is appreciated.

    Many thanks ....

  7. #7
    Registered User
    Join Date
    09-22-2014
    Location
    Wellingborough, England
    MS-Off Ver
    Microsoft Office 2016 Professional
    Posts
    49

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Thanks for your help Leo but I think I now a have a solution that is working ....
    I will mark this thread as closed ...

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Glad we could help & thanks for the feedback

  9. #9
    Registered User
    Join Date
    09-22-2014
    Location
    Wellingborough, England
    MS-Off Ver
    Microsoft Office 2016 Professional
    Posts
    49

    Re: Copy value of cell d22 to e22 based on value in cell d22

    Hi Fluff13,

    The formula you converted to VBA works but only if cell E22 is ="", I missed something off of the original formula I asked you to convert to VBA.

    I need the value of Cell $CJ22 to equal the value of Cell $D22 if certain criteria are met ...

    This is the formula I actually need to convert to a VBA macro, can you help me please?

    =IF(AND(OR($D22="Long Term Sick",$D22="Maternity Leave",$D22="Left the Business"),OR($E22="",$E22="Electric",$E22="Gas")),$D22,"")


    I would like this macro to work on rows $D22:$D221


    Any help or suggestions would be appreciated
    Last edited by Jalica; 04-25-2018 at 01:35 PM.

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: Copy value of cell d22 to e22 based on value in cell d22

    How about
    Please Login or Register  to view this content.

+ 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. Copy and Paste Cell X number of times based on Adjacent Cell
    By GabeGabe in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-07-2016, 11:40 AM
  2. Replies: 6
    Last Post: 11-19-2015, 09:36 PM
  3. [SOLVED] Find a row based on cell value, copy cell in different column, paste below
    By gaker10 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-02-2014, 07:12 AM
  4. Replies: 2
    Last Post: 01-31-2014, 09:34 AM
  5. Copy Cell to next empty cell on other worksheets based on date and category
    By mainebf in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2012, 02:43 PM
  6. Replies: 2
    Last Post: 11-08-2011, 11:10 AM
  7. Replies: 3
    Last Post: 07-15-2010, 08:49 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