range error

KDS14589

Board Regular
Joined
Jan 10, 2019
Messages
203
Office Version
  1. 2016
Platform
  1. Windows
I'm new to VBA so be gentle.
This just started happening today.
Whenever I select a preexisting command button to a macro, I get an error window listing the range as "Wrong number of arguments or invalid property assignment"
What can I do now?

Code:
Sub clearswitchboard()
     Sheets("general.switchboard").Select
    RANGE("R57:AR155").Select
    Selection.ClearContents
    RANGE("af51").Select
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Did you copy and paste your code into your post or did you type it in. The reason I ask is because if you copy and pasted the code, then the two places where the word "RANGE" appears would of have been changed to "Range" when the editor compiled the code. Are you sure you have the spelling of the worksheet "general.switchboard" exactly as it appears in your workbook.

If you manually typed your code into your post, and the worksheet name is correct then the code should run.
 
Upvote 0
The code works for me.
What version of Excel do you have?
 
Upvote 0
and it still doing it
I've also got all up-to-date
 
Last edited:
Upvote 0
Again, is the code in your OP a direct copy and paste from the VBE.
 
Upvote 0
Does the error point to any of the lines in the code?
 
Upvote 0
As well as the unanswered questions above: What module is this code in?
 
Upvote 0
@KDS14589

Just for the heck of it, could you answer my Post #6 , referring your Original Post...

If you do not understand the question, I could re-phrase it.
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

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