Re: Clear Contents Macro
- From: Dave Peterson <petersod@xxxxxxxxxxxxxxxx>
- Date: Sat, 21 Jun 2008 13:57:55 -0500
If your *** names really have that space character, then change:
ms = "***" & i
to
ms = "*** " & i
MSE wrote:
I have six sheets. Their names are Sheet 1, Sheet 2, Sheet 3, Sheet 4, Sheet
5, and *** 6. This part of the code is having the problem I think.
Sheets(ms).Range("C7,C9,C16:C23,C26:C33").ClearContents
It gets highlighted in yellow with a yellow arrow pointing to it when I try
to run the macro. Any ideas?
"Don Guillett" wrote:
Number of sheets? Name of sheets?
If desired, send your workbook with these snippets and the code to my
address below
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@xxxxxxxxxxxxx
"MSE" <MSE@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D4572E32-3865-4261-96C2-943F0F0A7ECB@xxxxxxxxxxxxxxxx
Thank you for your input. When I try to run the Macro the screen
switches
to visual basic and I get a message that says Run-time error '9' Subscript
out of range, Continue, End, Debug, Help. Any thoughts?
"Don Guillett" wrote:
try this.
Sub clearcellsonsheets()
For i = 1 To 5
ms = "***" & i
Sheets(ms).Range("C7,C9,c16:C23,C26:C33").ClearContents
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@xxxxxxxxxxxxx
"MSE" <MSE@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CB51A454-35EE-44F9-9B32-41F640FD2B1E@xxxxxxxxxxxxxxxx
I have a workbook with six worksheets. On Sheet 6, I want to create a
macro
linked to an Excel button from the forms toolbar. I want the macro to
only
clear the contents of *** 1, *** 2, *** 3, *** 4, and *** 5
in
the
following cells C7, C9, C16:C23, and C26:C33. I am trying to write a
code
that will do this, any thoughts?
--
Dave Peterson
.
- References:
- Re: Clear Contents Macro
- From: Don Guillett
- Re: Clear Contents Macro
- From: Don Guillett
- Re: Clear Contents Macro
- From: MSE
- Re: Clear Contents Macro
- Prev by Date: Re: Clear Contents Macro
- Next by Date: Re: Array Declaration Problem ??
- Previous by thread: Re: Clear Contents Macro
- Next by thread: Re: Clear Contents Macro
- Index(es):