Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default goto next if

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default goto next if

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default goto next if


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Yes / No - Goto VBA SamuelT[_12_] Excel Programming 4 May 24th 06 03:22 PM
When To use GOTO Sub? MC82[_5_] Excel Programming 4 May 10th 06 03:02 AM
On Error Goto doesn't goto Paul Excel Programming 1 October 15th 04 03:51 PM
On Error Goto doesn't goto Paul Excel Programming 0 October 15th 04 03:05 PM
VBA - using Goto - Please Help! ajliaks[_17_] Excel Programming 2 May 1st 04 03:16 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"