View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default 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?