I have the following code that I'm trying to utilize to copy data down to blank cells in Excel:
'COPYING DATA DOWN INTO EACH ROW
Range("A2").Select
Do Until ActiveCell.Offset(0, 1) = ""
If ActiveCell.Offset(1, 0) = "" Then
ActiveWorkbook.Names.Add Name:="TASK", RefersToR1C1:=ActiveCell
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell <> ""
If ActiveCell.Offset(1, 1) = "" Then
ActiveCell.Offset(1, 0).Select
Exit Do
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
ActiveCell.Offset(-1, 0).Select
ActiveWorkbook.Names.Add Name:="TASK2", RefersToR1C1:=ActiveCell
Range("TASK").Select
Selection.Copy
Range("TASK:TASK2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.End(xlDown).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
Selection.ClearContents
Range("A2").Select
End Sub
The coding will not work unless I change it to:
'COPYING DATA DOWN INTO EACH ROW
Range("A2").Select
Do Until ActiveCell = ""
When I change the coding to: Do Until ActiveCell = "", the code will run until down to maximum row limit of Excel.
Any ideas?
An example of what my Excel sheet looks like is:
Apr-10 54 67 87
89 99 99
67 45 45
Aug-10 87 99 14
55 77 99
77 99 89
I'm looking for the date data (Apr-10, etc) to copy down to the blank rows. It should also stop when there truly is no data left in the the column.
Please help...
'COPYING DATA DOWN INTO EACH ROW
Range("A2").Select
Do Until ActiveCell.Offset(0, 1) = ""
If ActiveCell.Offset(1, 0) = "" Then
ActiveWorkbook.Names.Add Name:="TASK", RefersToR1C1:=ActiveCell
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell <> ""
If ActiveCell.Offset(1, 1) = "" Then
ActiveCell.Offset(1, 0).Select
Exit Do
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
ActiveCell.Offset(-1, 0).Select
ActiveWorkbook.Names.Add Name:="TASK2", RefersToR1C1:=ActiveCell
Range("TASK").Select
Selection.Copy
Range("TASK:TASK2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.End(xlDown).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
Selection.ClearContents
Range("A2").Select
End Sub
The coding will not work unless I change it to:
'COPYING DATA DOWN INTO EACH ROW
Range("A2").Select
Do Until ActiveCell = ""
When I change the coding to: Do Until ActiveCell = "", the code will run until down to maximum row limit of Excel.
Any ideas?
An example of what my Excel sheet looks like is:
Apr-10 54 67 87
89 99 99
67 45 45
Aug-10 87 99 14
55 77 99
77 99 89
I'm looking for the date data (Apr-10, etc) to copy down to the blank rows. It should also stop when there truly is no data left in the the column.
Please help...