range error

KDS14589

Board Regular
Joined
Jan 10, 2019
Messages
54
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
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,506
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,594
Office Version
  1. 2007
Platform
  1. Windows
The code works for me.
What version of Excel do you have?
 

KDS14589

Board Regular
Joined
Jan 10, 2019
Messages
54
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

and it still doing it
I've also got all up-to-date
 
Last edited:

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,506
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Again, is the code in your OP a direct copy and paste from the VBE.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,594
Office Version
  1. 2007
Platform
  1. Windows

ADVERTISEMENT

Does the error point to any of the lines in the code?
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
As well as the unanswered questions above: What module is this code in?
 

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,506
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
@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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,729
Messages
5,597,791
Members
414,176
Latest member
LK88

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
Top