r121a947
New member
- Joined
- Jun 29, 2019
- Messages
- 49
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- Office 365
I am trying to make a RemoveDuplicates macro. The problem I have is that once a Remove Duplicates routine is recorded, the macro remembers the original used range and does not always cover the entire used range.
Is there an easy way to return/retrieve the last row's number? Or the last cell's address? That would make the macro always check/use the entire used range.
My recorded macro code is below.
Also, is there a way to stop the macro recorder before the Remove Duplicates process is started when one clicks OK?
All help is greatly appreciated.
Thanks.
Is there an easy way to return/retrieve the last row's number? Or the last cell's address? That would make the macro always check/use the entire used range.
My recorded macro code is below.
Also, is there a way to stop the macro recorder before the Remove Duplicates process is started when one clicks OK?
All help is greatly appreciated.
Thanks.
Code:
Sub RemoveDuplicates()
'
' RemoveDuplicates Macro
' Remove dupes on B, C, D
'
' Keyboard Shortcut: Ctrl+Shift+X
'
ActiveSheet.Range("$A$1:$L$1045").RemoveDuplicates Columns:=Array(2, 3, 4), _
Header:=xlNo
End Sub