Select Range Name Q

S

Sean

Beginners Q

The code below I am using to try and clear the contents of 12 range
names, but it doesn't clear any info, the range names are correct, not
sure what is wrong

Sub ClearCells()

Application.ScreenUpdating = False
Application.Goto Reference:=Array("Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
Selection.ClearContents
Application.ScreenUpdating = True
Range("A1").Select
 
N

Norman Jones

Hi Sean,

Try:

'=============>>
Public Sub ClearCells()
Range("Jan", "Feb", "Mar", "Apr", "May", _
"Jun", "Jul", "Aug", "Sep", "Oct", _
"Nov", "Dec").ClearContents
End Sub
'<<=============
 
B

Bob Phillips

Application.ScreenUpdating = False
Range("Jan", "Feb", "Mar", "Apr", "May", "Jun", _
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec").ClearContents
Application.ScreenUpdating = True
Range("A1").Select



--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
S

Sean

Hi Sean,

Try:

'=============>>
Public Sub ClearCells()
Range("Jan", "Feb", "Mar", "Apr", "May", _
"Jun", "Jul", "Aug", "Sep", "Oct", _
"Nov", "Dec").ClearContents
End Sub
'<<=============

---
Regards,
Norman









- Show quoted text -

Thanks Norman, I tried that but it debugs at 'Range' with error "Wrong
number of arguements or invalid property assignment"
 
N

Norman Jones

Hi Sean,
Thanks Norman, I tried that but it debugs at 'Range' with error "Wrong
number of arguements or invalid property assignment"


I could reproduce your error if one of the named ranges
did not exist.
 
N

Norman Jones

Hi Sean,

My Fault!

Try, instead:

'=============>>
Public Sub ClearCells()
Range("Jan, Feb, Mar, Apr, May, Jun," _
& "Jul, Aug, Sep, Oct, Nov, Dec").ClearContents
End Sub
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top