range error

KDS14589

New Member
Joined
Jan 10, 2019
Messages
29
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,471
Office Version
365, 2010
Platform
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
10,201
Office Version
2007
Platform
Windows
The code works for me.
What version of Excel do you have?
 

KDS14589

New Member
Joined
Jan 10, 2019
Messages
29
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,471
Office Version
365, 2010
Platform
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
10,201
Office Version
2007
Platform
Windows
Does the error point to any of the lines in the code?
 

Peter_SSs

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

igold

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

Forum statistics

Threads
1,089,555
Messages
5,408,923
Members
403,243
Latest member
psabin8951

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top