+ Reply to Thread
Results 1 to 2 of 2

Loop columns using variable in Range

  1. #1
    Registered User
    Join Date
    03-16-2015
    Location
    Cleveland, Ohio
    MS-Off Ver
    2013
    Posts
    12

    Loop columns using variable in Range

    I know that referencing a fixed column but looping through rows using ThisWorkbook.Worksheets("Sheet1").Range("A" & VariableRow).Value works fine.

    Is there an equivalent for looping through columns (and a fixed row)? My instinct was to try ThisWorkbook.Worksheets("Sheet1").Range(VariableColumn & "2").Value but this causes a 1004 runtime error.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,943

    Re: Loop columns using variable in Range

    Try:
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. Loop from variable range
    By Dal123 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-06-2016, 06:08 PM
  2. Loop variable subscript out of range
    By maurice1991 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2015, 07:31 AM
  3. Help reading For loop with range variable
    By Maradona_10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2014, 02:49 PM
  4. Using a variable to loop through columns in VBA
    By jelilly in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-04-2014, 04:06 PM
  5. Do Loop with variable range
    By Austex_egger in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-08-2013, 03:08 PM
  6. Do Loop with Variable Range
    By Austex_egger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2013, 03:52 PM
  7. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 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