Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 8 columns of user entered data which i need to copy into another
worksheet. I have the code to move it over but not all 8 colums will be filled all the time and i dont want to copy over blank lines. I want to write code to say if cell 1 is empty donot copy go to cell 2, then if cell 2 is empty, donot copy goto cell 3..... and so on. it may be that random colums have data so i need it to check each one. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Post your code
"Miree" wrote: I have 8 columns of user entered data which i need to copy into another worksheet. I have the code to move it over but not all 8 colums will be filled all the time and i dont want to copy over blank lines. I want to write code to say if cell 1 is empty donot copy go to cell 2, then if cell 2 is empty, donot copy goto cell 3..... and so on. it may be that random colums have data so i need it to check each one. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub MoveData() NewRow = 1 With Sheets("Sheet1") LastRow = 0 For ColCount = 0 To 8 LRow = .Cells(Rows.Count, ColCount).End(xlUp).Row If LRow LastRow Then LastRow = LRow End If Next ColCount For RowCount = 1 To LastRow LastCol = .Cells(RowCount, Columns.Count). _ End(xlToLeft).Column If .Range("A" & RowCount) < "" Or _ LastCol 1 Then .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRow) NewRow = NewRow + 1 End If Next RowCount End With "Miree" wrote: I have 8 columns of user entered data which i need to copy into another worksheet. I have the code to move it over but not all 8 colums will be filled all the time and i dont want to copy over blank lines. I want to write code to say if cell 1 is empty donot copy go to cell 2, then if cell 2 is empty, donot copy goto cell 3..... and so on. it may be that random colums have data so i need it to check each one. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Yes / No - Goto VBA | Excel Programming | |||
When To use GOTO Sub? | Excel Programming | |||
On Error Goto doesn't goto | Excel Programming | |||
On Error Goto doesn't goto | Excel Programming | |||
VBA - using Goto - Please Help! | Excel Programming |