+ Reply to Thread
Results 1 to 9 of 9

Add a number of rows to a selected row and place a incremental suffix to data in col A

  1. #1
    Registered User
    Join Date
    05-31-2012
    Location
    Sulphur, Louisiana
    MS-Off Ver
    MS Office 365
    Posts
    23

    Add a number of rows to a selected row and place a incremental suffix to data in col A

    Hey Folks!
    I'm trying to create a macro that will copy and insert additional lines to a selected row (got this part see "Insert_Line" in attached spread sheet). The problem I'm having is adding a letter to the end of the Data in column "A".
    Thanks for the help
    Attached Files Attached Files
    Bonehead_98
    Struggling excel user

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    Try
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Registered User
    Join Date
    05-31-2012
    Location
    Sulphur, Louisiana
    MS-Off Ver
    MS Office 365
    Posts
    23

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    kvsrinivasamurthy, Thanks you so much. Thats exactly what I needed. Have a great weekend

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    Welcome. This can work only up to Z.

  5. #5
    Registered User
    Join Date
    05-31-2012
    Location
    Sulphur, Louisiana
    MS-Off Ver
    MS Office 365
    Posts
    23

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    kvsrinivasamurthy, I've been using this macro and it works great, but I see a need to modify it. I need to be able to continue the sequence. In other words if I have added 3 lines the letter suffix would be "A", "B", "C", I need to be able to add additional lines and continue with the sequence "D", "E", "F" and so on. Would this be doable?
    Thanks

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    Try.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-31-2012
    Location
    Sulphur, Louisiana
    MS-Off Ver
    MS Office 365
    Posts
    23

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    Amazing, I keep waiting for the day that this stuff will make sense to me, but it hasn't yet. I am so thankful for people like you that are willing to help. Thank you so much.

  8. #8
    Registered User
    Join Date
    05-31-2012
    Location
    Sulphur, Louisiana
    MS-Off Ver
    MS Office 365
    Posts
    23

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    kvsrinivasamurthy,
    Yeah, it's me again. I need to remove the dash/hyphen, for example 5_22A-6566621-Pl001 will become 5_22A-6566621-Pl001A, 5_22A-6566621-Pl001B, 5_22A-6566621-Pl001C and if I need to add additional rows they will become 5_22A-6566621-Pl001D, 5_22A-6566621-Pl001E and 5_22A-6566621-Pl001F . I've been trying to figure it out on my own, I think it will be here "If Left(Right(ActiveCell, 2), 1) = "-" Then" and here "ActiveCell.Offset(T, 0) = ActiveCell.Offset(T, 0) & "-" & Chr(T + 64)".
    " If Left(Right(ActiveCell, 2), 1) = "-" Then" appears to be looking for a "-" to continue the letters at the end of a previous line insert
    "ActiveCell.Offset(T, 0) = ActiveCell.Offset(T, 0) & "-" & Chr(T + 64)" is where it actually begins the whole process. I can remove the "-" here, but when I continue it gives me CA, CB, CC, etc.
    If you should decide to help, Thank You and if you don't thanks anyway

  9. #9
    Registered User
    Join Date
    05-31-2012
    Location
    Sulphur, Louisiana
    MS-Off Ver
    MS Office 365
    Posts
    23

    Re: Add a number of rows to a selected row and place a incremental suffix to data in col A

    kvsrinivasamurthy, This is probably a duplicate post, I thought I may have put the other one in the wrong place.
    Yeah, it's me again. I need to remove the dash/hyphen, for example 5_22A-6566621-Pl001 will become 5_22A-6566621-Pl001A, 5_22A-6566621-Pl001B, 5_22A-6566621-Pl001C and if I need to add additional rows they will become 5_22A-6566621-Pl001D, 5_22A-6566621-Pl001E and 5_22A-6566621-Pl001F and not 5_22A-6566621-Pl001CD, 5_22A-6566621-Pl001CE and 5_22A-6566621-Pl001CF. I've been trying to figure it out on my own, I think it will be here "If Left(Right(ActiveCell, 2), 1) = "-" Then" and here "ActiveCell.Offset(T, 0) = ActiveCell.Offset(T, 0) & "-" & Chr(T + 64)".
    " If Left(Right(ActiveCell, 2), 1) = "-" Then" appears to be looking for a "-" to continue the letters at the end of a previous line insert
    "ActiveCell.Offset(T, 0) = ActiveCell.Offset(T, 0) & "-" & Chr(T + 64)" is where it actually begins the whole process. I can remove the "-" here, but when I continue it gives me CA, CB, CC, etc.
    If you should decide to help, Thank You and if you don't thanks anyway
    Last edited by Bonehead_98; 10-05-2023 at 03:55 PM.

+ 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. Replies: 2
    Last Post: 07-22-2019, 01:47 AM
  2. [SOLVED] Place one column of data into another worksheet into selected fields
    By Cbird in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2017, 06:26 PM
  3. Replies: 8
    Last Post: 05-30-2017, 11:39 AM
  4. [SOLVED] Fill rows with incremental data
    By kobiashi in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-23-2016, 09:25 AM
  5. [SOLVED] Incremental value with a text prefix and a suffix
    By Rowane in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2015, 03:06 PM
  6. Copy selected rows and place them into a new worksheet.
    By sungen99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2014, 08:40 AM
  7. Textbox values won't place into selected Listbox rows
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2010, 07:34 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