#5 Invalid procedure call or argument

bobkap

Active Member
Joined
Nov 22, 2009
Messages
323
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I cannot get past this line of code. I keep getting this invalid message. If I just use something like "Range("$A$1:$h$20")" I don't get the error and the macro runs fine. But, I want to use variables as my range is going to vary every time this macro is run. Any help would be greatly appreciated.

VBA Code:
Range(Cells(1, 1), Cells(finalrow, finalcol)).RemoveDuplicates Columns:=Array(email, courseyear), Header:=xlYes
 
Cross posted https://www.myonlinetraininghub.com/excel-forum/vba-macros/variables-do-not-work

While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered elsewhere.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Cross posted https://www.myonlinetraininghub.com/excel-forum/vba-macros/variables-do-not-work

While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered elsewhere.

I had no idea that anyone was still reacting to my posts. I have been a fan and follower of Bill Jelen for years now. It is never my intent to violate anyone's policies. Rather, I assumed one source was finished so I contacted my friends at My Online Training Hub and they asked me to post my questions on their site.

Never did I have any harm intended. I'm a "rule follower" to an extreme.
 
Upvote 0
I had no idea that anyone was still reacting to my posts.
We were just waiting for you to answer the questions asked & had no way of knowing you had decided to ignore us & post the same question elsewhere.
 
Upvote 0
We were just waiting for you to answer the questions asked & had no way of knowing you had decided to ignore us & post the same question elsewhere.
I NEVER ignore the responses I get here. I tried all of them with no success.
 
Upvote 0
I'm tied up in meetings all day and I'm on Pacific time and not able to look at the moment. I will let you know as soon as I can.
 
Upvote 0
For the record, judging by your file on the other site, the problem is that finalcol is 7 but courseyear is 8.
You need to recalculate the final column.
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,101
Members
449,205
Latest member
ralemanygarcia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top