#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Excel Macro

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Excel Macro


That is a good question. I am hoping that the macro works its way down
the page so that if there happen to be two blank rows (in column A) in
a row that after the macro is run the first one will fill and then when
it gets to the next row the row above it will already be filled so that
there is data in the cells to copy and paste. I hope this makes sense.
Also, the data starts from the first row in the sheet so there will
never be a case where there are blank rows on the top of the sheet
however when it gets to the bottom of the data set (approx 690 rows) I
would like it to end the macro so that it doesn't keep doing this all
the way down to row 65,536

Thanks in advance!

Brian

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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM


All times are GMT +1. The time now is 05:43 AM.

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

About Us

"It's about Microsoft Excel"