+ Reply to Thread
Results 1 to 6 of 6

automating a macro to increment row

  1. #1
    Registered User
    Join Date
    07-04-2006
    Posts
    6

    automating a macro to increment row

    Hello!

    I have built a calculator in excel in order to work out insurance premiums as a testing device for our software (to ensure the rate engine is working).

    I have built a macro that copies information from a dataset and pastes it into the calculator in order to get a premium. This is fine, but i want it to do it over and over working from a different line of data each time.

    Hopefully this is making sense.. so on the code below where it is looking at Row 3 of 'DATA' sheet, i want to increment by one every time it runs until it gets to row 1000.

    Does anyone know how i can do this? I will keep checking the forum so if you have any questions please ask and i can give more detail. Many thanks.

    Darren


    ---->code>
    Please Login or Register  to view this content.
    Last edited by mudraker; 04-16-2007 at 07:35 AM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Q1. Is it to process all the rows in 1 continous loop?
    If yes where does the data go on the input sheet as your current macro uses 2 different rows in column B

    If No Q2. Does it need to keep track of the row number only as long as the workbook is currently open - Starts from row 3 everytime the workbook is opened or does it need to always keep track of the next row number?
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    Please Login or Register  to view this content.
    Should do it - use the & symbol to concatenate variable with column reference, and a simple for next loop.

    HTH

    Dave

  4. #4
    Registered User
    Join Date
    07-04-2006
    Posts
    6
    Sweep - that does the trick, great . The only problem is that its continually copying the first line only. So this will need to change:

    Range("B3:T3").Select

    Now, being a copmlete amature, is it as simple as inserting the ("B" & loopy:"T" & loopy) ??

    I have tried this but get a syntax error at the moment, guess my syntax is rubbish....

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    ("B" & loopy &":T" & loopy)

    might get it

    D

  6. #6
    Registered User
    Join Date
    07-04-2006
    Posts
    6
    That's great - thanks very much. Much appreciated!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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