Remove a cell from a range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Awesome... Thank you....

Gary''s Student said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top