Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Clearing Data ranges from Multiple Worksheets

Hi:

I am trying to clear the contents of certain cells in
several different worksheets at the same time. (Hopefully
with one macro. There are 9 worksheets, with each one
containing 10 pages. the pages are sized exactly the same
and may, or may not all contain data. I have been able to
get the pages to copy and paste to another sheet, but
would like to be able to select all of the pages and
clear data from the data ranges, without clearing my page
formatting, headers, etc. The data ranges are also
exactly the same cells in each worksheet.

Thanks,

Sam


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Clearing Data ranges from Multiple Worksheets

I'm confused. Do you mean that you have 9 workBOOKs; each containing 10
workSHEETs?

If so, with only these workbooks open, run a macro such as the following:

Sub ClearDataRanges()
Dim wb As Workbook, ws As Worksheet
For Each wb In Workbooks
For Each ws In wb.Worksheets
ws.Range("A1:Z100").ClearContents
Next
Next
End Sub

--

Vasant



"Sam Fowler" wrote in message
...
Hi:

I am trying to clear the contents of certain cells in
several different worksheets at the same time. (Hopefully
with one macro. There are 9 worksheets, with each one
containing 10 pages. the pages are sized exactly the same
and may, or may not all contain data. I have been able to
get the pages to copy and paste to another sheet, but
would like to be able to select all of the pages and
clear data from the data ranges, without clearing my page
formatting, headers, etc. The data ranges are also
exactly the same cells in each worksheet.

Thanks,

Sam




  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Clearing Data ranges from Multiple Worksheets

Hi Vasant:

Actually, it is only 1 workbook. it has 18 different
worksheets. of the 18, 9 of them contain data that I
input. Also, each of the 9 worksheets containing data,
have 10 "Pages". Each page is formatted and also contains
headers, columns for certain calculations, Total etc.,
and are reusable. However, in each worksheet, the data
input range is exactly the same, and I would like to
clear the contents in those cells in one felled swoop.
Cells with data follow this progression:
("A15:L62", "A81:L128","A147:L194",) etc...
After I have copied the data to another sheet, I would
like to empty the data input cells, but not the other
cells on the pages. Also, I only want to perform this on
the 9 specific worksheets. All of the other worksheets
contain different data that I do not want to clear.

Thanks, Sam

-----Original Message-----
I'm confused. Do you mean that you have 9 workBOOKs;

each containing 10
workSHEETs?

If so, with only these workbooks open, run a macro such

as the following:

Sub ClearDataRanges()
Dim wb As Workbook, ws As Worksheet
For Each wb In Workbooks
For Each ws In wb.Worksheets
ws.Range("A1:Z100").ClearContents
Next
Next
End Sub

--

Vasant



"Sam Fowler" wrote

in message
...
Hi:

I am trying to clear the contents of certain cells in
several different worksheets at the same time.

(Hopefully
with one macro. There are 9 worksheets, with each one
containing 10 pages. the pages are sized exactly the

same
and may, or may not all contain data. I have been able

to
get the pages to copy and paste to another sheet, but
would like to be able to select all of the pages and
clear data from the data ranges, without clearing my

page
formatting, headers, etc. The data ranges are also
exactly the same cells in each worksheet.

Thanks,

Sam




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Clearing Data ranges from Multiple Worksheets

In that case, try something like this and modify to suit:

Sub ClearDataRanges()
Dim ws As Worksheet, i As Long
For Each ws In Worksheets(Array("Sheet1", "Sheet2", _
"Sheet3", "Sheet4", "Sheet5", "Sheet6", "Sheet7", "Sheet8", "Sheet9"))
'Substitute your 9 worksheet names above
For i = 0 to 9
ws.Range("A15:L62").Offset(i * 66).ClearContents
Next i
Next
End Sub

--

Vasant

wrote in message
...
Hi Vasant:

Actually, it is only 1 workbook. it has 18 different
worksheets. of the 18, 9 of them contain data that I
input. Also, each of the 9 worksheets containing data,
have 10 "Pages". Each page is formatted and also contains
headers, columns for certain calculations, Total etc.,
and are reusable. However, in each worksheet, the data
input range is exactly the same, and I would like to
clear the contents in those cells in one felled swoop.
Cells with data follow this progression:
("A15:L62", "A81:L128","A147:L194",) etc...
After I have copied the data to another sheet, I would
like to empty the data input cells, but not the other
cells on the pages. Also, I only want to perform this on
the 9 specific worksheets. All of the other worksheets
contain different data that I do not want to clear.

Thanks, Sam

-----Original Message-----
I'm confused. Do you mean that you have 9 workBOOKs;

each containing 10
workSHEETs?

If so, with only these workbooks open, run a macro such

as the following:

Sub ClearDataRanges()
Dim wb As Workbook, ws As Worksheet
For Each wb In Workbooks
For Each ws In wb.Worksheets
ws.Range("A1:Z100").ClearContents
Next
Next
End Sub

--

Vasant



"Sam Fowler" wrote

in message
...
Hi:

I am trying to clear the contents of certain cells in
several different worksheets at the same time.

(Hopefully
with one macro. There are 9 worksheets, with each one
containing 10 pages. the pages are sized exactly the

same
and may, or may not all contain data. I have been able

to
get the pages to copy and paste to another sheet, but
would like to be able to select all of the pages and
clear data from the data ranges, without clearing my

page
formatting, headers, etc. The data ranges are also
exactly the same cells in each worksheet.

Thanks,

Sam




.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Naming ranges on multiple worksheets Jim New Users to Excel 3 November 23rd 09 09:08 PM
How do i update multiple data ranges across multiple worksheets? mwah Excel Discussion (Misc queries) 0 July 6th 06 04:57 AM
how to merge ranges from multiple worksheets crowleydl Excel Worksheet Functions 0 August 5th 05 07:24 PM
copy ranges from multiple worksheets simora Excel Worksheet Functions 2 May 18th 05 01:42 AM
Printing Multiple Ranges from Multiple Worksheets Dave Barkley[_2_] Excel Programming 1 July 22nd 03 06:10 PM


All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"