By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,955 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,955 IT Pros & Developers. It's quick & easy.

Named Range problem

P: 63
Can anyone tell me how to create a named range that can then be referred to later in VBA for excel 2000. At the minute I am simply expanding any ranges out to the maximum possible size before running my scripts on them. Ideally I would like some code that identifies what the data range is each time.

My current code is just Range("N2:N4000").select

where the 4000th row is definitely beyond where the data ends.


Any help would be greatly appreciated

thanks
May 14 '08 #1
Share this Question
Share on Google+
4 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

ActiveSheet.UsedRange.Rows.Count

Gives you Number of rows used..

REgards
Veena
May 14 '08 #2

P: 63
Thanks Veena - so how would I add that into my code? If I want the task to apply to the range (N2:N(ActiveSheet.UsedRange.Rows.Count)) - how would I write that?


thanks again





ActiveSheet.UsedRange.Rows.Count

Gives you Number of rows used..

REgards
Veena[/quote]
May 14 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

Try this:

Expand|Select|Wrap|Line Numbers
  1. Dim RStr As String
  2. RStr = "N2:N" &  ActiveSheet.UsedRange.Rows.Count
  3. Range(RStr).select 
  4.  
Regards
Veena
May 14 '08 #4

P: 63
Worked a treat - thanks a lot
May 16 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.