Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to enhance this macro (really short)
Deno,
Untested, but try Sub Macro1() For Each rw In Worksheets(1).Cells(Selection.Column, 1).CurrentRegion.Rows this = rw.Value If this = last Then rw.Clear last = this Next End Sub -- HTH Bob Phillips "DenoxiS" wrote in message om... Hi, I have following macro to clean up the repeating lines on a column: Sub Macro1() For Each rw In Worksheets(1).Cells(1, 1).CurrentRegion.Rows this = rw.Cells(1, 1).Value If this = last Then rw.Cells(1, 1).Clear last = this Next End Sub It works for the first column of the first worksheet. I couldn't refer to the current column of the current worksheet. How can I modify it so my macro work on the selected/active/higlighted column of the current worksheet? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to enhance this macro (really short)
Should have tested it. Try this version
cRows = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row For Each rw In Range(Cells(1, ActiveCell.Column), Cells(cRows, ActiveCell.Column)) this = rw.Value If this = last Then rw.Clear last = this Next The sheet to modify needs to be active for this. -- HTH Bob Phillips "Bob Phillips" wrote in message ... Deno, Untested, but try Sub Macro1() For Each rw In Worksheets(1).Cells(Selection.Column, 1).CurrentRegion.Rows this = rw.Value If this = last Then rw.Clear last = this Next End Sub -- HTH Bob Phillips "DenoxiS" wrote in message om... Hi, I have following macro to clean up the repeating lines on a column: Sub Macro1() For Each rw In Worksheets(1).Cells(1, 1).CurrentRegion.Rows this = rw.Cells(1, 1).Value If this = last Then rw.Cells(1, 1).Clear last = this Next End Sub It works for the first column of the first worksheet. I couldn't refer to the current column of the current worksheet. How can I modify it so my macro work on the selected/active/higlighted column of the current worksheet? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Short Macro | Excel Discussion (Misc queries) | |||
ZED - Need a short macro fix | Excel Discussion (Misc queries) | |||
Enhance Sort Results | Excel Discussion (Misc queries) | |||
Onkey vs Macro Short cut key | Excel Discussion (Misc queries) | |||
what do you use to enhance financial data? | Excel Worksheet Functions |