+ Reply to Thread
Results 1 to 8 of 8

Need help in creating repeat macro

Hybrid View

wewillexcel Need help in creating repeat... 09-09-2014, 02:44 PM
Speshul Re: Need help in creating... 09-09-2014, 02:47 PM
HaHoBe Re: Need help in creating... 09-09-2014, 03:01 PM
ggracia Re: Need help in creating... 09-09-2014, 02:58 PM
wewillexcel Re: Need help in creating... 09-09-2014, 02:58 PM
wewillexcel Re: Need help in creating... 09-09-2014, 03:04 PM
Speshul Re: Need help in creating... 09-09-2014, 03:06 PM
wewillexcel Re: Need help in creating... 09-09-2014, 03:02 PM
  1. #1
    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
    For i = 1 to 10
    Cells(i, "A").value = i
    Next i
    This would make cells A1 through A10 list the numbers of 1 through 10.

    You can start a for...next from 30, so;
    
    for i = 30 to 60
    
    'do this stuff
    
    next i
    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.

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

    Re: Need help in creating repeat macro

    Hi, wewillexcel,

    maybe like
    Sub EF1036066()
    Dim varArr As Variant
    Dim lngArr As Long
    Dim lngCtr As Long
    Dim lngRow As Long
    Dim lngCol As Long
    
    Const clngSTART As Long = 30
    Const clngEND As Long = 60
    
    lngRow = 10
    varArr = Array("Apple_V", "Pear_V", "Orange_V")
    
    For lngCtr = clngSTART To clngEND
      lngCol = 6
      For lngArr = LBound(varArr) To UBound(varArr)
        Cells(lngRow, lngCol).Value = varArr(lngArr) & Format(lngCtr, "00")
        lngCol = lngCol + 1
      Next lngArr
      lngRow = lngRow + 10
    Next lngCtr
    End Sub
    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

+ 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. 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