|
-
Jun 7th, 2007, 07:39 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Clearing cells in a range?
Rate my response if I helped
Go Hard Or Go Home
-
Jun 7th, 2007, 07:49 PM
#2
Thread Starter
Hyperactive Member
Re: Clearing cells in a range?
Forgot to add :-
The first clearcontents works, that is, worksheet 1, but fails on the second
Run-time erro 1004
Application-defined or object-defined error
Yeah - ta. Thx for that error message. 
I've even tried this
Code:
Worksheets("Jul06").Range("A5:AN905").ClearContents
Worksheets("Aug06").Range("A5:AN905").ClearContents
Worksheets("Sept06").Range("A5:AN905").ClearContents
But again - fails on the second clearcontents attempt.
Rate my response if I helped
Go Hard Or Go Home
-
Jun 7th, 2007, 07:51 PM
#3
Thread Starter
Hyperactive Member
Re: Clearing cells in a range?
Hmm. Seems the worksheets are protected (no password).
BRB.
Rate my response if I helped
Go Hard Or Go Home
-
Jun 7th, 2007, 07:57 PM
#4
Thread Starter
Hyperactive Member
Re: Clearing cells in a range?
Sorted. I'll just paste and run this in each workbook. I'll be done by the time you read my ramblings. 
Code:
Sub ClearWorksheet()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect
ws.Range("A5", "AN905").ClearContents
Next
End Sub
Thanks for your help Gaz!
Rate my response if I helped
Go Hard Or Go Home
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|