+ Reply to Thread
Results 1 to 8 of 8

Need help in creating repeat macro

  1. #1
    Registered User
    Join Date
    08-27-2014
    Location
    Boston, MA
    MS-Off Ver
    2013
    Posts
    11

    Need help in creating repeat macro

    I am trying to create a macro that would have rows repeat, with the addition of a sequentially increasing number at the end of certain, corresponding cells (starting with the number 30 to number 60, say).

    For example:

    Apple_V30, Pear_V30, Orange_V30, Apple_V31, Pear_V31, Orange_V31

    The comma signifies the boundary of a cell. I am looking to do this for the header row.

    Please let me know if I should clarify.

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Need help in creating repeat macro

    You can use a For...Next loop to get a value increasing on each pass.

    An example of one is
    Please Login or Register  to view this content.
    This would make cells A1 through A10 list the numbers of 1 through 10.

    You can start a for...next from 30, so;
    Please Login or Register  to view this content.
    [/B]
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  3. #3
    Registered User
    Join Date
    09-05-2014
    Location
    US
    MS-Off Ver
    2013
    Posts
    1

    Re: Need help in creating repeat macro

    Hello,

    Use This

    Please Login or Register  to view this content.
    Greetings

  4. #4
    Registered User
    Join Date
    08-27-2014
    Location
    Boston, MA
    MS-Off Ver
    2013
    Posts
    11

    Re: Need help in creating repeat macro

    @Speshul: This would be for ordering numbers sequentially down a column, no? I am looking to do this across the top row, and not just to enter numbers but to enter something like "_V30" to "_V60" at the end of a variable name like "Apple."

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Need help in creating repeat macro

    Hi, wewillexcel,

    maybe like
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Registered User
    Join Date
    08-27-2014
    Location
    Boston, MA
    MS-Off Ver
    2013
    Posts
    11

    Re: Need help in creating repeat macro

    @ggracia: This is exactly what I was looking for - Thanks!

  7. #7
    Registered User
    Join Date
    08-27-2014
    Location
    Boston, MA
    MS-Off Ver
    2013
    Posts
    11

    Re: Need help in creating repeat macro

    Thanks to everyone else who offered their advice!

  8. #8
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Need help in creating repeat macro

    Quote Originally Posted by wewillexcel View Post
    @Speshul: This would be for ordering numbers sequentially down a column, no? I am looking to do this across the top row, and not just to enter numbers but to enter something like "_V30" to "_V60" at the end of a variable name like "Apple."

    To go across columns instead of rows;

    For i = 1 to 10
    Cells( 1, i ).value = i
    Next i

    Instead of

    For i = 1 to 10
    Cells(i, "A").value = i
    Next i

    The i increases by one each time, the i can be placed anywhere or mean anything as well, for example if you had an array it could be used to pick one of the array values and put it at the end of a string; MyString & MyArr(i)

+ 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. Creating unique id's for repeat occurances
    By Nickyh1984 in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 06-05-2014, 06:03 PM
  2. [SOLVED] Macro - Repeat macro a specific number of times
    By uvinduds in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2013, 02:42 PM
  3. How to repeat creating individual charts from multiple rows
    By central in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-12-2012, 01:55 PM
  4. Creating "blocks" that will automatically repeat when needed
    By MARYUNGER in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2007, 01:49 PM
  5. [SOLVED] Searching a list with repeat entries and creating a sum
    By Brian Connolly in forum Excel General
    Replies: 1
    Last Post: 02-03-2005, 06:06 PM

Tags for this Thread

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