View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_4_] Rowan[_4_] is offline
external usenet poster
 
Posts: 38
Default copy data if data exists

Assuming your data starts in Cell A1 then Answer1:

Dim eRow As Long
eRow = Cells(Rows.Count, 1).End(xlUp).Row
Rows("1:" & eRow).EntireRow.Copy Destination:=Sheets(2).Range("A1")

Answer2:

Dim eRow As Long
Dim eCol As Integer
eRow = Cells(Rows.Count, 1).End(xlUp).Row
eCol = Cells(1, Columns.Count).End(xlToLeft).Column + 1
Range(Cells(1, eCol), Cells(eRow, eCol)).Value = 1

Hope this helps
Rowan

"Daniel M" wrote:

I have a sheet with x numbers of rows that i need to copy to another sheet.
If it was row 1 - 5 each time that woudl be fine but it dynamically changes.
how do i select only the rows that have data?

Second question. I have data in x numbers of rows and i want to add a "1" in
an empty column but only where data exists in the rows. How can this be
done?

Thanks.


dm.