+ Reply to Thread
Results 1 to 8 of 8

How to find a number in a string and copy it to the cell below while adding 1 to it

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    95

    How to find a number in a string and copy it to the cell below while adding 1 to it

    Hello,

    I'm trying to figure out how to find the last two numbers in a cell in column A and copy that cell to the cell below it while incrementing the last two numbers by one.

    I wrote a noobish code that creates the values in column A as ID in increments of 10. However, there's another code that runs AFTER the ID has been created which inserts rows below it. To which I'll need to go back and search for the blank rows below the previously created ID's and populate the same ID but incrementing by one.

    Here's the sample workbook.
    Incrementing.xlsm

    Any help would be greatly appreciated.

    Thanks in advance.
    Last edited by GreenTee; 03-05-2015 at 03:24 PM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    Hi GreenTee,

    Assuming that your ID will always have only one _ and that it will be just before the number, replace your SplitCellToNewRows with this version, that i have modified to put the numbers in while it copies:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-15-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    Quote Originally Posted by Arkadi View Post
    Hi GreenTee,

    Assuming that your ID will always have only one _ and that it will be just before the number, replace your SplitCellToNewRows with this version, that i have modified to put the numbers in while it copies:

    Please Login or Register  to view this content.


    wow this is awesome!!!

    this works as I described it

    However, one little change.. is there anyway I can make the incrementing by one as a separate macro? I didn't want it to run all at once just in case I manually wanted to enter extra rows. So the ID incrementing by one would have to be a separate macro.

  5. #5
    Registered User
    Join Date
    01-15-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.


    Sorry John.. this wasn't working for me. I tried running it, but it just didn't do anything.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    GreenTee,

    So forget what i sent, and use your original macros. After yours are done, run this one:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-15-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    that works perfectly!!

    Thanks a ton!

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How to find a number in a string and copy it to the cell below while adding 1 to it

    Glad it helped!

+ 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] Find a string in cell with multiple values based on number in another cell
    By ccantara in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-03-2015, 03:29 PM
  2. Find Multiple Instances of a String, copy whatever number value is in next Cell and add it
    By arvind3tthiru in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2013, 11:26 PM
  3. [SOLVED] VBA Needed to find number/text within cell string and copy out to new cell
    By Campbell A in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-19-2013, 10:15 AM
  4. [SOLVED] Adding a button to find string in column and fill out the first empty cell
    By vaznlyfe in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-27-2012, 04:16 PM
  5. how to find Certain String in a column, select/Copy the cell till another String
    By excelkeechak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-18-2009, 10:59 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