I have some data in Excel that looks like this:
[pre]
A B C D
1 abc xyz 123 gt5
2 cde opr 65 vw
3 njk
4 opi
5 hgf oiu 890 uyt
6 iuy
7 jhg
8 uiy lkj 896 kjl
8 654
[/pre]
I need to fill the data in the missing cells with the data from the row above, i.e. take data in A2:C2 and paste it into rows 3 and 4 (in columns A thru C), and the do the same down the rows. I do know how many rows of data I have to deal with.
I need to end up ti something like this:
[pre]
A B C D
1 abc xyz 123 gt5
2 cde opr 65 vw
3[blue] cde opr 65 [/blue] njk
4[blue] cde opr 65[/blue] opi
5 hgf oiu 890 uyt
6[blue] hgf oiu 890 [/blue] iuy
7[blue] hgf oiu 890[/blue] jhg
8 uiy lkj 896 kjl
8[blue] uiy lkj 896 [/blue] 654
[/pre]
I do it right now with this code, but as you can see there is a lot of Copy/Select/Paste
Code:
[green]
'Repeat Main information in empty rows
'intMainRow is the last row of data[/green]
For intTempRow = 2 To intMainRow
If .Range("A" & intTempRow).Value = "" Then
.Range("A" & intTempRow - 1 & ":C" & intTempRow - 1).Copy
.Range("A" & intTempRow).Select
.ActiveSheet.Paste
End If
Next intTempRow
But I know there should be a better, faster way to accomplish this.
Have fun.
---- Andy
A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.