View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
David Nebenzahl David Nebenzahl is offline
external usenet poster
 
Posts: 9
Default Request for VB to do something simple (insert text in a columnof cells)

On 11/20/2007 1:56 AM Gary''s Student spake thus:

With VBA, run david2:

Sub david2()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To n
Cells(i, 2).Value = "XYZ" & Cells(i, 1).Value
Next
End Sub


Thanks for that. I changed it a little:

Sub Format4Upload
n = Cells(Rows.Count, "D").End(xlUp).Row
For i = 2 To n
Cells(i, 4).Characters(0, 0).Insert ("XYZ")
Next
End Sub

Works fine. But of course I need something mo how do I skip cells
that are blank? (In other words, don't insert anything if the cell is
blank).

Thanks again.