Thread: Excel Macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Excel Macro

Sub fillblank()
Dim blankcells As Range
On Error GoTo noblank
Set blankcells = Columns("A").SpecialCells(xlBlanks)
For Each cella In blankcells
cella.Value = Range("A" & cella.Row - 1).Value
Range("B" & cella.Row).Value = Range("B" & cella.Row - 1).Value
Range("E" & cella.Row).Value = Range("E" & cella.Row - 1).Value
Range("F" & cella.Row).Value = Range("F" & cella.Row - 1).Value
Range("G" & cella.Row).Value = Range("G" & cella.Row - 1).Value
Range("K" & cella.Row).Value = Range("K" & cella.Row - 1).Value
Next cella
noblank:
End Sub

But what should happen if the first row is empty and there is no row above?

Regards,
Stefi


€˛Bongard€¯ ezt Ć*rta:

Hi I am trying to make a macro where if column A is blank, the macro
then copys the info from the row above in columns A, B, E, F,G and K
down to the row where A is Blank. For example:

A B C D
E
xyz abc def ghi
jkl
asj lop


After macro was run would look like this:

A B C D
E
xyz abc def ghi
jkl
xyz abc asj lop
jkl

Any ideas? Thanks!

-Brian