Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Remove a cell from a range

How do you remove a cell (Range) from a range object.
I have a named range and I want to remove the selected cell from the range.

IE.
Range namedRange; // Contains selecedRange
Range selecedRange;
namedRange.Remove(selecedRange);

Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Remove a cell from a range

Re-Create & Dis-Invite:
This drops the cell B9 from a range:

Sub divorce()
Set r = Range("A1:Z100")
'
' we want to drop B9 from the range
'
Set r2 = Nothing
For Each rr In r
If rr.Address < "$B$9" Then
If r2 Is Nothing Then
Set r2 = rr
Else
Set r2 = Union(r2, rr)
End If
End If
Next
Set r = r2
MsgBox (r.Address)
End Sub

--
Gary''s Student - gsnu200744


"C#_Programmer" wrote:

How do you remove a cell (Range) from a range object.
I have a named range and I want to remove the selected cell from the range.

IE.
Range namedRange; // Contains selecedRange
Range selecedRange;
namedRange.Remove(selecedRange);

Is this possible?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Remove a cell from a range

Awesome... Thank you....

"Gary''s Student" wrote:

Re-Create & Dis-Invite:
This drops the cell B9 from a range:

Sub divorce()
Set r = Range("A1:Z100")
'
' we want to drop B9 from the range
'
Set r2 = Nothing
For Each rr In r
If rr.Address < "$B$9" Then
If r2 Is Nothing Then
Set r2 = rr
Else
Set r2 = Union(r2, rr)
End If
End If
Next
Set r = r2
MsgBox (r.Address)
End Sub

--
Gary''s Student - gsnu200744


"C#_Programmer" wrote:

How do you remove a cell (Range) from a range object.
I have a named range and I want to remove the selected cell from the range.

IE.
Range namedRange; // Contains selecedRange
Range selecedRange;
namedRange.Remove(selecedRange);

Is this possible?

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
how to remove old sort range Lou E Excel Discussion (Misc queries) 3 May 29th 08 04:10 PM
Remove #VALUE! from ConCat Range Function Excel Helps Excel Worksheet Functions 5 January 23rd 08 01:37 PM
How to remove borders in a range of cells? DORI Excel Programming 17 December 9th 05 02:45 AM
Remove all borders from a range quartz[_2_] Excel Programming 4 September 20th 05 02:16 AM
Can I remove blanks from a range without using sort? Hugh Murfitt Excel Discussion (Misc queries) 6 March 8th 05 08:37 AM


All times are GMT +1. The time now is 06:16 PM.

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"