bobkap
Active Member
- Joined
- Nov 22, 2009
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
I need to remove duplicates when columns 3 and 8 match. This line works fine:
Range(Cells(2, 1), Cells(finalrow, finalcol)).RemoveDuplicates Columns:=Array(3, 8), Header:=xlYes
But, I prefer to use variables of course. I've tried as below by replacing the 3 and 8 with a variable but it always bombs out. Even though it made no sense. I even tried putting quotes on the variables but still no dice.
Range(Cells(2, 1), Cells(finalrow, finalcol)).RemoveDuplicates Columns:=Array(email, yearbk), Header:=xlYes
Is there no way to use variables this way?
Any help is most appreciated.
Range(Cells(2, 1), Cells(finalrow, finalcol)).RemoveDuplicates Columns:=Array(3, 8), Header:=xlYes
But, I prefer to use variables of course. I've tried as below by replacing the 3 and 8 with a variable but it always bombs out. Even though it made no sense. I even tried putting quotes on the variables but still no dice.
Range(Cells(2, 1), Cells(finalrow, finalcol)).RemoveDuplicates Columns:=Array(email, yearbk), Header:=xlYes
Is there no way to use variables this way?
Any help is most appreciated.