Thread: Prefill column
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Prefill column

This seems to work for me

Sub tryme()
mylast = Cells(Cells.Rows.Count, "B").End(xlUp).Row
mytext = Cells(1, "A")
For j = 2 To mylast
If Cells(j, "A") = "" Then
Cells(j, "A") = mytext
Else
mytext = Cells(j, "A")
End If
Next j
End Sub

Save file before trying it - just incase!
best wishes
--
Bernard Liengme
http://people.stfx.ca/bliengme
Microsoft Excel MVP

"SITCFanTN" wrote in message
...
Below is a sample of the data I download to a spreadsheet. I need to
write a
macro to fill in the empty cells in column A with the data from the
previous
cell in the column with data. I know I didn't explain that well but in
the
example below, I need TF48 to fill in Col A for rows 3,4 & 5. Then T16A
would fill in row 7 and T505 in row 9 and 10. I hope I've explained this
sufficiently. Thanks in advance for your help.

1 A B C D
2 TF48 $100.00 ABC 20091116
3 $ 50.00 DTR 20091116
4 $ 25.00 PLO 20091116
5 $ 75.00 FRD 20091116
6 T16A $100.35 UYE 20091116
7 $124.55 PLE 20091116
8 T505 $109.00 REW 20091115
9 $876.90 JLO 20091113
10 $234.90 REW 20091116