LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default How to set named range in macro?

I have a macro that is called each time a different sheet in the
workbook is selected. The macro is supposed to define the determined
range as a named ramge, "FilterRange".

Sub CtyShtFltRng()
Dim lCol as Long
Dim lRow As Long
Dim wActSheet As Worksheet
Set wActSheet = ActiveSheet


Set rStart = Range("B3")
lRow = rStart.End(xlDown).Row - 1
lCol = rStart.End(xlToRight).Column
Set rCtyShtFltRng = Range(rStart, Cells(lRow, lCol))
Set wActSheet.Names("FilterRange") = rCtyShtFltRng <---ERROR
wActSheet.Range("FilterRange").Select

End Sub


I'm getting an "wrong number of arguments or invlalid property
assignment" at the marked line. I've tried about 10 or 12 variations on
this line, but none worked. Can someone tell me how to make this work?
Thanks!

 
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
Macro to Show (and Print) Only Named Range? Pausert Excel Discussion (Misc queries) 1 October 25th 10 06:09 PM
Named Range Macro Lost Excel Discussion (Misc queries) 1 September 22nd 09 11:17 PM
Insert Named Range using Excel Macro [email protected] Excel Programming 1 January 27th 06 12:15 AM
How do I get a macro to ask for a 'range' to go to with a choice of Named ranges? neuf Excel Programming 1 June 4th 05 05:33 PM
Problem with named range as VBA macro parameter Ken[_11_] Excel Programming 4 March 5th 04 02:16 PM


All times are GMT +1. The time now is 01:51 AM.

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

About Us

"It's about Microsoft Excel"