+ Reply to Thread
Results 1 to 7 of 7

Incrementing a range variable

  1. #1
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Incrementing a range variable

    Hi all

    I have a piece of code that runs through multiple tables (they vary in length) and replacing values. All in the same worksheet

    My code looks like this:

    Please Login or Register  to view this content.
    I can't figure out how i get c to move to the next table and count the rows in that.
    In my code c stays constant, and I need it to change and match the new row count.

    Br/Danny

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Incrementing a range variable

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Incrementing a range variable

    Can you post an example of what your worksheet with the data tables looks like?

    Edit: Norie types faster...

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Incrementing a range variable

    Can you attach a workbook, so we can see the 'table' structure you are trying to loop through.

    Edit: I'll get in the queue!
    Last edited by Olly; 03-05-2014 at 08:12 AM.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Incrementing a range variable

    Sure thing

    If you look at the bottom of the Sample sheet, you can see that on the second table, the code doesn't change the "Plate" column all the way to the bottom.
    I guess it's because the c variable doesn't update to match the correct Row count from the second table.
    Any ideas?


    SampleDRW050314.xlsm

    Br/Danny

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Incrementing a range variable

    Try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-08-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Incrementing a range variable

    That appears to be working beautifully!

    Thanks a lot.

    /Danny

+ 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. Incrementing a variable - How to do?
    By UsmanBPD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 07:30 AM
  2. Incrementing Range in a loop
    By Flipty in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-22-2008, 06:30 AM
  3. [SOLVED] Variable Incrementing
    By John in forum Excel General
    Replies: 3
    Last Post: 05-12-2006, 05:16 PM
  4. Replies: 2
    Last Post: 12-19-2005, 07:20 PM
  5. Incrementing Variable shortcut
    By crazybass2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2005, 12:06 PM

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