Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
translate lotus 1-2-3 macro into excel macro using excel 2000 | Excel Programming |