bibhu_datta_rout
New Member
- Joined
- Jun 8, 2008
- Messages
- 4
Hi, I have a excel spreadsheet which has order in one column and event1 and event2 in two other columns.One order can have multiple events.In the given spreadsheet. When an order has muliple events, then except first record, all other cells of order column is NULL. I want to populate those null cells with the just above orders.
e.g. before
order event1 event2
1 abc def
bac1 def1
bac def
2 abc def
abc def
def ghi
3 def ghi
After
order event1 event2
1 abc def
1 bac1 def1
1 bac def
2 abc def
2 abc def
2 def ghi
3 def ghi
This I could do with macro as follows
====================
Sub specialmacro()Dim rng As RangeDim celle As RangeDim str1 As StringDim str2 As StringDim rowe As Long rowe = 1str1 = "A"str2 = "A"With Sheets("Sheet1") Set rng = Range(.Cells(rowe, str1), .Cells(.Cells.Rows.Count, str2).End(xlUp))End With For Each celle In rng If celle = "" Then celle = celle.Offset(-1, 0) End IfNext celle End Sub========================</PRE>
Now my problem is after running the macro, I do some modifications.</PRE>
Once the modifcation done, I want to bring it back to before format.</PRE>
i.e.something like </PRE>
order event1 event2
1 abc def
bac1 def1
bac def
2 abc def
abc def
def ghi
3 def ghi
</PRE>
Is that possible? Thanks for your help.</PRE>
e.g. before
order event1 event2
1 abc def
bac1 def1
bac def
2 abc def
abc def
def ghi
3 def ghi
After
order event1 event2
1 abc def
1 bac1 def1
1 bac def
2 abc def
2 abc def
2 def ghi
3 def ghi
This I could do with macro as follows
====================
Sub specialmacro()Dim rng As RangeDim celle As RangeDim str1 As StringDim str2 As StringDim rowe As Long rowe = 1str1 = "A"str2 = "A"With Sheets("Sheet1") Set rng = Range(.Cells(rowe, str1), .Cells(.Cells.Rows.Count, str2).End(xlUp))End With For Each celle In rng If celle = "" Then celle = celle.Offset(-1, 0) End IfNext celle End Sub========================</PRE>
Now my problem is after running the macro, I do some modifications.</PRE>
Once the modifcation done, I want to bring it back to before format.</PRE>
i.e.something like </PRE>
order event1 event2
1 abc def
bac1 def1
bac def
2 abc def
abc def
def ghi
3 def ghi
</PRE>
Is that possible? Thanks for your help.</PRE>