#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default "deselect"

Use InsertNameDefine to bring up the dialog box in Excel. Then you can
modify the range in the Refers To: window.

"mark" wrote:

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

tried that earlier. doesn't seem to work.

it only shows me the first line of the definitions, which only goes through
the fifth cell.

if I try to arrow right, it picks up new cell addresses where the cursor
currently is, but I haven't been able to get it to move to the cell that I
need to remove, in the range name definition.

"JLGWhiz" wrote:

Use InsertNameDefine to bring up the dialog box in Excel. Then you can
modify the range in the Refers To: window.

"mark" wrote:

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

ahhh, I got it.

this is a template, and there are only a few rows in the worksheet.

if I delete column BR, then re-insert it, and redefine the things that
should be there, it will remove BR8 from the range name.

but it seems like there ought to be a programmatic way available.

is there?

"mark" wrote:

tried that earlier. doesn't seem to work.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default "deselect"

The only other way I know is to completely redo the name and omit that one.
You can do it manually in Excel, or use VBA by:

myRange = Range("A1, B5.....IX750") 'example only to establishe the
'non-contiguous range.
myRange.Name = "SomeName" 'example to assign the range name

good luck.

"mark" wrote:

tried that earlier. doesn't seem to work.

it only shows me the first line of the definitions, which only goes through
the fifth cell.

if I try to arrow right, it picks up new cell addresses where the cursor
currently is, but I haven't been able to get it to move to the cell that I
need to remove, in the range name definition.

"JLGWhiz" wrote:

Use InsertNameDefine to bring up the dialog box in Excel. Then you can
modify the range in the Refers To: window.

"mark" wrote:

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default "deselect"

You could loop through the cells:

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim myRngToSkip As Range

With Worksheets("sheet1")
'add/subtract addresses here!
Set myRngToSkip = .Range("BR8,F6")

For Each myCell In .Range("Name1").Cells
If Intersect(myCell, myRngToSkip) Is Nothing Then
If myRng Is Nothing Then
Set myRng = myCell
Else
Set myRng = Union(myRng, myCell)
End If
Else
'skip it, it's in the range to skip
End If
Next myCell

If myRng Is Nothing Then
MsgBox "No cells!"
Else
myRng.Select 'just for testing!
myRng.Name = "Name2" 'or even Name1 if you want to reuse that name.
End If
End With

End Sub



mark wrote:

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default "deselect"

Disregard the VBA code in the previous message. The correct methor for
adding a range name is:

Names.Add Name:="SomeName", RefersTo:="=sheet1!$a$1, sheet1!$b$6,..."

I slip off into senility occasionally. HTH



"mark" wrote:

tried that earlier. doesn't seem to work.

it only shows me the first line of the definitions, which only goes through
the fifth cell.

if I try to arrow right, it picks up new cell addresses where the cursor
currently is, but I haven't been able to get it to move to the cell that I
need to remove, in the range name definition.

"JLGWhiz" wrote:

Use InsertNameDefine to bring up the dialog box in Excel. Then you can
modify the range in the Refers To: window.

"mark" wrote:

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

yeah, that would work.

Thanks guys!

I just did my delete column, but then I had to go through and re-insert the
formulas, and edit the range name where the cell is properly called out.

thanks for the help.

"Dave Peterson" wrote:

You could loop through the cells:

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim myRngToSkip As Range

With Worksheets("sheet1")
'add/subtract addresses here!
Set myRngToSkip = .Range("BR8,F6")

For Each myCell In .Range("Name1").Cells
If Intersect(myCell, myRngToSkip) Is Nothing Then
If myRng Is Nothing Then
Set myRng = myCell
Else
Set myRng = Union(myRng, myCell)
End If
Else
'skip it, it's in the range to skip
End If
Next myCell

If myRng Is Nothing Then
MsgBox "No cells!"
Else
myRng.Select 'just for testing!
myRng.Name = "Name2" 'or even Name1 if you want to reuse that name.
End If
End With

End Sub



mark wrote:

Hi.

I have a range name that defines a LOT of discontinuous cells... probably
more than 100.

But unfortunately, there is one cell, BR8 , included in this range name
definition, which should not be.

I've used the .Address and the .RefersTo properties to try to get the
addresses of all of the cells define. But, the length of the properties must
not be long enough to handle the definitions.

I can use F5 and go to the discontinuous range, but I need a way to
"deselect" the one cell that should not be there, so that I can then redefine
the range name to be the current selection.

Help?

Thanks.


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

thank again. exactly what I needed.

I'll keep it in mind for the future.

"Dave Peterson" wrote:

You could loop through the cells:

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default "deselect"

hi, Mark !

you have anther approach in your first post ;)

hth,
hector.

thank again. exactly what I needed.

I'll keep it in mind for the future.

"Dave Peterson" wrote:

You could loop through the cells:





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

not sure what you're trying to tell me.

the approach in my "first post", or the "first response", either one, didn't
work.

"Héctor Miguel" wrote:

hi, Mark !

you have anther approach in your first post ;)

hth,
hector.

thank again. exactly what I needed.

I'll keep it in mind for the future.

"Dave Peterson" wrote:

You could loop through the cells:




  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default "deselect"

hi, Mark !

not sure what you're trying to tell me.
the approach in my "first post", or the "first response", either one, didn't work.


i'm sorry... by "first post" i meant your other thread: "opposite of Union"

hth,
hector.


  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default "deselect"

okay, thanks, Hector.

I tried to post the "opposite of Union" one just before I left work last
night.

But then later, after I got home, I couldn't find that post at all. Not
sure what happened?

Since I couldn't find the first one in the listing of posts, that's why I
wrote the second one.

Thanks, I see both now.


"Héctor Miguel" wrote:

hi, Mark !

not sure what you're trying to tell me.
the approach in my "first post", or the "first response", either one, didn't work.


i'm sorry... by "first post" i meant your other thread: "opposite of Union"

hth,
hector.



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
can someone tell me how to deselect "select all" in Excel? scott Excel Worksheet Functions 3 February 17th 10 07:35 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
deselect any "active" charts in workbook Raul Excel Programming 2 April 18th 08 05:21 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
"deselect ?" a range or change state from edit to ? mark kubicki Excel Programming 0 August 11th 04 07:34 PM


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