View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
dbKemp dbKemp is offline
external usenet poster
 
Posts: 58
Default remove blank rows

On Jan 2, 10:42 am, scolbert
wrote:
I've got a workbook where I'm using code to copy rows of data from one sheet
to a recap sheet if a condition is met (all rows with "Y" in one column).
The data is being copied to sheet two, but blank rows are being left in
between rows where the "Y" condition is not met. My current code is:
'have x start at row 2
x = 2

'loop until a blank row is found
Do While Sheets("Jan 09").Cells(x, 1).Value < ""

If Sheets("Jan 09").Cells(x, 11).Value = "Y" Then
'this will put the value of column 1 "Payable To" in the recap
sheet
Sheets("2009 Recap").Select
Cells(x, 1).Value = Sheets("Jan 09").Cells(x, 1)
End If

'increase the value of x by 1 to act on the next row
x = x + 1

Loop

all assistance is appreciated!


You need a separate counter for Recap sheet that only gets incremented
if Jan 09 cell value is Y.