+ Reply to Thread
Results 1 to 6 of 6

Macro to Insert copy of Row based on text String

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Talking Macro to Insert copy of Row based on text String

    Hi guys
    This is my first post - I hope it goes in correctly...

    I need help to alter data in my spreadsheet but I have no VBA knowledge and I can't find anyone at my employment to help. I hope someone here can assist.


    I would like a macro to check cells in Column "A" to detect the first 8 characters of text as "employee". In some cases the text is EmployeeID or EmployeeNumber, so I need to detect the first 8 characters.
    When a match of the first 8 characters is found insert copy of Row 1 below each instance of the detected text.
    (Actually Row 1 is an empty row except for the data in cell A1. So inserting a blank row and then copying the data from cell A1 into the first cell of the new Row will work too)


    I was trying to alter these snippets of code but I'm lost...
    The Data Begins in Row 5 of Column A

    (first snippet)

    Please Login or Register  to view this content.
    (second snippet)

    Please Login or Register  to view this content.

    I hope you guys can help -
    Thanks,
    Larry

    Moderator's Edit: Use code tags when posting code. To do so in future, select your code and click on the # icon at the top of your ost window.
    Last edited by j2591; 02-04-2013 at 10:30 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Insert copy of Row based on text String

    Do you have a sample file that you can upload?

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to Insert copy of Row based on text String

    Thanks for the response...
    I have added the sample file. There are two tabs - one to show what the data looks like before altering and the second tab shows what I would like the data to look like after the macro runs. I have highlighted the insertions in green.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to Insert copy of Row based on text String

    Does anyone have some helpful advice or solution?
    -Thanks

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Macro to Insert copy of Row based on text String

    Give this a try

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  6. #6
    Registered User
    Join Date
    01-16-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to Insert copy of Row based on text String

    Mike
    Thanks for the reply.
    I have run some tests on some small files and things are working fine. I'll try to get the testing completed and will post another response based on the results.

    Thanks,
    Larry

+ 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