Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Short Macro Joonas K Excel Discussion (Misc queries) 0 August 7th 08 05:31 PM
ZED - Need a short macro fix [email protected] Excel Discussion (Misc queries) 3 January 19th 07 03:32 PM
Enhance Sort Results maperalia Excel Discussion (Misc queries) 6 January 17th 07 11:11 PM
Onkey vs Macro Short cut key rgarber50 Excel Discussion (Misc queries) 1 July 10th 05 07:34 PM
what do you use to enhance financial data? nicole Excel Worksheet Functions 4 May 11th 05 11:04 PM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"