Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default create named range in each sheet in workbook

I'm using this code to delineate the range I want filters applied to:

Range(Range("b3"), Range("b3").End(xlDown).End(xlToRight) _
.Offset(-1, 2)).Select

Now I want a macro to go into every worksheet in the workbook, the
number may vary, and create a named range called FilterRange with the
worksheet's name. Than I can use that named range to apply filters to
from buttons/macros. Can anyone help me here?
Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default create named range in each sheet in workbook

I would Dim wks As Worksheet and Dim strName As String, then
For Each wks In WhateverWorkbook
strName = wks.Name
strName = strName & "FilterRange"
' set range, using strName as the name
Next wks

HTH
Ed

"davegb" wrote in message
oups.com...
I'm using this code to delineate the range I want filters applied to:

Range(Range("b3"), Range("b3").End(xlDown).End(xlToRight) _
.Offset(-1, 2)).Select

Now I want a macro to go into every worksheet in the workbook, the
number may vary, and create a named range called FilterRange with the
worksheet's name. Than I can use that named range to apply filters to
from buttons/macros. Can anyone help me here?
Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default create named range in each sheet in workbook

Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
With sh
.Range(.Range("B3"), .Range("B3").End(xlDown).End(xlToRight) _
.Offset(-1, 2)).Name = "'" & sh.Name & "'!FilterRange"
End With
Next sh


--

HTH

RP
(remove nothere from the email address if mailing direct)


"davegb" wrote in message
oups.com...
I'm using this code to delineate the range I want filters applied to:

Range(Range("b3"), Range("b3").End(xlDown).End(xlToRight) _
.Offset(-1, 2)).Select

Now I want a macro to go into every worksheet in the workbook, the
number may vary, and create a named range called FilterRange with the
worksheet's name. Than I can use that named range to apply filters to
from buttons/macros. Can anyone help me here?
Thanks in advance.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default create named range in each sheet in workbook

Thanks Bob and Ed! Got it working.

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
Named Range From One Workbook Used in Validation Drop Down in 2nd Workbook Minitman Excel Discussion (Misc queries) 3 August 19th 08 05:30 PM
How to create a dynamic named range? Sunita Excel Discussion (Misc queries) 3 March 28th 08 07:47 PM
Create a Named Range in Excel with VBA GoKingBee Excel Programming 2 December 7th 04 08:13 PM
List named range per sheet in workbook Salomon Excel Programming 0 June 28th 04 11:22 PM
Create named range Robert[_16_] Excel Programming 2 October 27th 03 11:57 PM


All times are GMT +1. The time now is 11:46 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"