Results 1 to 4 of 4

Dynamic Columns and Rows Selecting all Loop

Threaded View

  1. #1
    Registered User
    Join Date
    02-15-2012
    Location
    Indianapolis, USA
    MS-Off Ver
    Excel 2007
    Posts
    9

    Dynamic Columns and Rows Selecting all Loop

    Hi,

    I'm using a spreadsheet that is updated often, new rows and columns are added almost daily. I'm trying to use a loop to start as a column select all the data in the column apply the conditional formatting then move to the next column.

    I know how to use a macro and apply the conditional formatting however, I'm struggling with trying to move along each column. Here is what I have so far:

    Dim LastColumn As Long
    Dim lngRows As Long
    Dim rngC As Range
    
                LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
    
               lngRows = Cells(Rows.Count, 1).End(xlUp).Row
                Range("A1").Select
                Set rngC = Selection.CurrentRegion
                For j = 6 To LastColumn
               StartCel = Cells(2, j)
                LastCel = Cells(lngRows, j)
                
                Range(StartCel, LastCel).Select
                
                
                Next
    I continue to get an error message saying I'm out of range when the program gets to "Range(StartCel,LastCel).Select".


    In summary I want to just have a loop that goes through the spreadsheet and selects all the data in Column F then in column G,H etc.

    I did not include my code about conditional formatting.

    please help!

    Thank you in advance for taking the time to help me!
    Last edited by excel0831; 02-22-2012 at 05:41 PM. Reason: Solved problem!

Thread Information

Users Browsing this Thread

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

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