View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MattG MattG is offline
external usenet poster
 
Posts: 27
Default Help with loop-I'm stuck

I am trying to loop through a pivot table to look for values by row. The
number of rows and columns will vary.

Basically, if in Row 5 only one cell from Column B to the last column(not
counting the "Grand Total") is not blank then the column after "Grand Total"
should say "First Time".

If Columns C and D are not blank the first column after "grand Total" should
say "Two Times in a Row". etc, etc.

Here's what I have. This is too advanced for me.

Dim LastCell As Range
Dim WS As Worksheet
Set WS = ActiveSheet
Set LastCell = WS.UsedRange.SpecialCells(xlCellTypeLastCell)
Set lastcol = LastCell.Offset(-1, -1)

lstrw = .Cells(Rows.Count, "a").End(xlUp).Row

For myrow = lstrw To 5 Step -1

For Each Row In myrow

If Range("B:" & lastcol).Value 'stuck here