Excel Macro Code to add words to separate column
Results 1 to 5 of 5

Thread: Excel Macro Code to add words to separate column
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Mar 2017
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Excel Macro Code to add words to separate column

    I am looking for an excel macro code to do the following:

    If the name "Jane Doe" is in column H then I need the name "John Doe" dropped into column I.


    Thank you in advance for any help provided.

  2. #2
    Board Regular alansidman's Avatar
    Join Date
    Feb 2007
    Location
    Steamboat Springs
    Posts
    4,862
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Excel Macro Code to add words to separate column

    Where would Excel find John Doe to know that it should go into column I. Is it shown somewhere else in a relationship to Jane Doe? Give us some more details on worksheet/workbook layout and arrangement.
    Let me know if that works for you
    Alan

    Am Yisrael Chai

    Win 10--Office 2019
    When Posting Code, please use code tags.
    How to insert Mcode to Power Query https://excel.solutions/2017/11/powe...te-code-video/


  3. #3
    New Member
    Join Date
    Mar 2017
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Excel Macro Code to add words to separate column

    Jane Doe is find in column H and name repeats multiple times in column H, if the name Jane Doe is found in column H then I would like to drop the name John Doe into column I. John Doe is currently not on worksheet.

    Thanks,
    Tara

  4. #4
    Board Regular alansidman's Avatar
    Join Date
    Feb 2007
    Location
    Steamboat Springs
    Posts
    4,862
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Excel Macro Code to add words to separate column

    I suspect that there is more to this than a simple insertion of a name, but I will give you a simple code for this specific request. Keep in mind that this is specific to Jane Doe and will not work for any other names.

    Code:
    Sub JaneDoe
    Dim i as long, lr as long
    lr = range("A" & rows.count).end(xlup).row
    For i = 1 to lr
    If instr(Range("H" & i),"Jane Doe")>0 then
    Range("I" & i)= "John Doe"
    End if
    Next i
    End Sub
    Let me know if that works for you
    Alan

    Am Yisrael Chai

    Win 10--Office 2019
    When Posting Code, please use code tags.
    How to insert Mcode to Power Query https://excel.solutions/2017/11/powe...te-code-video/


  5. #5
    New Member
    Join Date
    Mar 2017
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Excel Macro Code to add words to separate column

    Thank you so much, code worked.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •