Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Creating a pivot table using all named ranges

I'm trying to write a macro to create a pivot table based on all the named
ranges in the current workbook WITHOUT including the danged print areas.
Each sheet has a range named after that worksheet (Example: the "Sheet1"
worksheet has a named range called "Sheet1", and so forth for all sheets). I
only want to include *those* named ranges and not the "Print_Area" ranges.
The pivot table would then be placed onto a new sheet.

The real problem that I'm having is that the macro needs to work for various
workbooks, each of which contain a different number of sheets. I'm having a
hard time figuring out how to nest the "For Each Sheet ... Next" loop into
the pivot table creation code.

Am I making this harder than it should be (like I did with my previous
question tonight)?

Thanks,

excelguru
(Should I really be calling myself "excelguru" in THIS place? I think not.)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Creating a pivot table using all named ranges

Hi Excelguru


Dim sh as worksheet
For each sh in activeworkbook.worksheets
'assuming that your range name is always the sheet-name
Range("sh.name").select 'or whatever you want to do
Next

Does that help?

Wolf


-----Original Message-----
I'm trying to write a macro to create a pivot table

based on all the named
ranges in the current workbook WITHOUT including the

danged print areas.
Each sheet has a range named after that worksheet

(Example: the "Sheet1"
worksheet has a named range called "Sheet1", and so

forth for all sheets). I
only want to include *those* named ranges and not

the "Print_Area" ranges.
The pivot table would then be placed onto a new sheet.

The real problem that I'm having is that the macro needs

to work for various
workbooks, each of which contain a different number of

sheets. I'm having a
hard time figuring out how to nest the "For Each

Sheet ... Next" loop into
the pivot table creation code.

Am I making this harder than it should be (like I did

with my previous
question tonight)?

Thanks,

excelguru
(Should I really be calling myself "excelguru" in THIS

place? I think not.)


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Creating a pivot table using all named ranges

Sorry, mistake
Range(sh.name).select
is correct

-----Original Message-----
Hi Excelguru


Dim sh as worksheet
For each sh in activeworkbook.worksheets
'assuming that your range name is always the sheet-name
Range("sh.name").select 'or whatever you want to do
Next

Does that help?

Wolf


-----Original Message-----
I'm trying to write a macro to create a pivot table

based on all the named
ranges in the current workbook WITHOUT including the

danged print areas.
Each sheet has a range named after that worksheet

(Example: the "Sheet1"
worksheet has a named range called "Sheet1", and so

forth for all sheets). I
only want to include *those* named ranges and not

the "Print_Area" ranges.
The pivot table would then be placed onto a new sheet.

The real problem that I'm having is that the macro

needs
to work for various
workbooks, each of which contain a different number of

sheets. I'm having a
hard time figuring out how to nest the "For Each

Sheet ... Next" loop into
the pivot table creation code.

Am I making this harder than it should be (like I did

with my previous
question tonight)?

Thanks,

excelguru
(Should I really be calling myself "excelguru" in THIS

place? I think not.)


.

.

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
Problem creating named ranges in a Macro! LABKHAND Excel Discussion (Misc queries) 2 January 8th 10 04:58 PM
Creating dynamic ranges which are named. U0107 Excel Worksheet Functions 1 January 5th 10 11:46 PM
creating a pivot table w/ ranges from 2 worksheets tl Excel Discussion (Misc queries) 1 August 20th 05 07:16 PM
Creating dymnamic named ranges John Baker Excel Programming 6 December 4th 03 02:05 PM
Creating Named Ranges in VBA Mark D'Agosta Excel Programming 4 October 4th 03 06:15 AM


All times are GMT +1. The time now is 07:19 PM.

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"