ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Range Name Q (https://www.excelbanter.com/excel-programming/388019-select-range-name-q.html)

Sean

Select Range Name Q
 
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


Norman Jones

Select Range Name Q
 
Hi Sean,

Try:

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


---
Regards,
Norman


"Sean" wrote in message
oups.com...
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




Bob Phillips

Select Range Name Q
 
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)



"Sean" wrote in message
oups.com...
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




Sean

Select Range Name Q
 
On Apr 24, 11:55 am, "Norman Jones"
wrote:
Hi Sean,

Try:

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

---
Regards,
Norman

"Sean" wrote in message

oups.com...



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- Hide quoted text -


- Show quoted text -


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


Norman Jones

Select Range Name Q
 
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.


---
Regards,
Norman



Norman Jones

Select Range Name Q
 
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
'<<=============


---
Regards,
Norman



Sean

Select Range Name Q
 
On Apr 24, 12:08 pm, "Norman Jones"
wrote:
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.

---
Regards,
Norman


Thanks Norman, and Bob, got it fixed


Sean

Select Range Name Q
 
On Apr 24, 12:08 pm, "Norman Jones"
wrote:
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.

---
Regards,
Norman


Thanks Norman and Bob, fixed the range name



All times are GMT +1. The time now is 02:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com