Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default how do i create a named range excluding particular cells

eg i want to create a range from A1 - A100 but i dont want to include A25 and
A48 can someone give me the code for this thankyou
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default how do i create a named range excluding particular cells

Select the required cells, then Insert=Name=Define ..."MyRange"

You should get this:

refers to:

=Sheet1!$A$1:$A$24,Sheet1!$A$26:$A$47,Sheet1!$A$49 :$A$100

"RobG2007" wrote:

eg i want to create a range from A1 - A100 but i dont want to include A25 and
A48 can someone give me the code for this thankyou

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default how do i create a named range excluding particular cells

On Jul 25, 11:08 am, RobG2007
wrote:
eg i want to create a range from A1 - A100 but i dont want to include A25 and
A48 can someone give me the code for this thankyou


Hi Rob,
You can divide the Range as you need as follows:

Sub CreateMyRange()
Dim MyRange As Range

Set MyRange = Application.Union(Range("A1:A24"), Range("A26:A47"),
Range("A49:A100"))
MyRange.Select ' Just to confirm the defined range. you can remove
this line later
MyRange.Name = "MyName"

End Sub

Hope this helps,

Regards,

Hesham ELhadad

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default how do i create a named range excluding particular cells

Is there a limit as to how many ranges can be joined in this manner?
I was trying to name a range on a worksheet that was 52 non-connecting
fields of 20 cells (A4:D8, A11:D15, ...). However, when I would check
the range anterwords, the first 10 sections or so would not be
included in the Named Range. User error, or Excel limitation?


On Jul 25, 3:35 am, wrote:
On Jul 25, 11:08 am, RobG2007
wrote:

eg i want to create a range from A1 - A100 but i dont want to include A25 and
A48 can someone give me the code for this thankyou


Hi Rob,
You can divide the Range as you need as follows:

Sub CreateMyRange()
Dim MyRange As Range

Set MyRange = Application.Union(Range("A1:A24"), Range("A26:A47"),
Range("A49:A100"))
MyRange.Select ' Just to confirm the defined range. you can remove
this line later
MyRange.Name = "MyName"

End Sub

Hope this helps,

Regards,

Hesham ELhadad



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default how do i create a named range excluding particular cells

Here's a link to an old thread that addresses this subject.

http://tinyurl.com/2exkca

There are 2 solutions suggested ... one by Dave Peterson using VBA and
another where I use a combination of smaller ranges to make one large, all
encompassing range.

Your choice since both work.
--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===

wrote in message
ups.com...
Is there a limit as to how many ranges can be joined in this manner?
I was trying to name a range on a worksheet that was 52 non-connecting
fields of 20 cells (A4:D8, A11:D15, ...). However, when I would check
the range anterwords, the first 10 sections or so would not be
included in the Named Range. User error, or Excel limitation?


On Jul 25, 3:35 am, wrote:
On Jul 25, 11:08 am, RobG2007
wrote:

eg i want to create a range from A1 - A100 but i dont want to include
A25 and
A48 can someone give me the code for this thankyou


Hi Rob,
You can divide the Range as you need as follows:

Sub CreateMyRange()
Dim MyRange As Range

Set MyRange = Application.Union(Range("A1:A24"), Range("A26:A47"),
Range("A49:A100"))
MyRange.Select ' Just to confirm the defined range. you can remove
this line later
MyRange.Name = "MyName"

End Sub

Hope this helps,

Regards,

Hesham ELhadad




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
Copy cells from named range Melissa Excel Discussion (Misc queries) 2 January 19th 07 08:27 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
Create tabs named after a group of cells? BM Excel Discussion (Misc queries) 3 September 26th 06 09:21 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Using a formula to create named range reference [email protected] Excel Worksheet Functions 4 June 29th 05 08:03 PM


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