+ Reply to Thread
Results 1 to 4 of 4

Macro to duplicate a string but increase the number in parentheses

  1. #1
    Registered User
    Join Date
    02-24-2017
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    65

    Macro to duplicate a string but increase the number in parentheses

    Hi all,

    I have some text that reads like

    if ([x - (1)] *1.00001 > [X])
    {
    asdfasdfadsf
    }

    All in Cell A1

    where x and asdfasdfadsf are irrelevant text.

    I'm looking to replicate this over and over, increasing the (1) by 1 every time until 50,000.
    Each replication should be placed in the cell below.
    Note that 1.0001 remains unchanged.

    So Cell A2 would read


    if ([x - (2)] *1.00001 > [X])
    {
    asdfasdfadsf
    }

    Cell A3 would read

    if ([x - (3)] *1.00001 > [X])
    {
    asdfasdfadsf
    }
    .......

    And Cell A50000 would read

    if ([x - (50000)] *1.00001 > [X])
    {
    asdfasdfadsf
    }


    Any and all help appreciated!

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Macro to duplicate a string but increase the number in parentheses

    Try this.
    Please Login or Register  to view this content.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Registered User
    Join Date
    08-27-2017
    Location
    Modesto, CA
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    91

    Re: Macro to duplicate a string but increase the number in parentheses

    with your data in A1, change the (1) to Row(1) and fill down to A50000

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to duplicate a string but increase the number in parentheses

    In case you would need some flexibility about the nb of rows.
    Reusing skywriter 's code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

+ 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] Regular Expression to get a string between parentheses in VBA
    By chief_abound in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-13-2015, 12:21 AM
  2. [SOLVED] Extracting all text from parentheses (including parentheses)
    By j4ke101 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 05-10-2013, 08:03 AM
  3. Replies: 3
    Last Post: 07-24-2012, 01:09 PM
  4. macro to increase a number
    By haiq in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2008, 08:41 AM
  5. [SOLVED] How do I produce a number in parentheses?
    By Carter Devereaux in forum Excel General
    Replies: 5
    Last Post: 06-08-2006, 01:20 AM
  6. [SOLVED] Macro to increase String Length?
    By aronnov in forum Excel General
    Replies: 2
    Last Post: 05-15-2006, 02:35 PM
  7. Increase number of macro names
    By Richard F. in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-20-2005, 11:05 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