I can't seem to get this to work.
I use this code to delete an entry from a range. It works ok until I delete the first entry in the range. When I do that the range name disappears. I know this is just my lack of knowledge about how ranges work but could someone please help. Can you also point me towards documentation on creating and manipulating ranges? I'm using Excel 2007. Thanks.
Code:
With SourceZoneSiteListBox
Set rng = Range(SourceZoneSiteList, Range(SourceZoneSiteList).End(xlDown))
For E = 0 To .ListCount - 1
If .Selected(E) Then
For Each c In rng
If c.Value = .List(E) Then
hitSW = True
Range(c.Address).Delete Shift:=xlShiftUp
Exit For
End If
Next c
End If
Next E
If hitSW = False Then
MsgBox "No collection site selected."
Sheets("Blank").Activate
Application.ScreenUpdating = True
CollectionZoneEntry.SetFocus
Exit Sub
End If
SourceZoneSiteListBox.Clear
Set rng = Range(SourceZoneSiteList, Range(SourceZoneSiteList).End(xlDown))
For Each c In rng
SourceZoneSiteListBox.AddItem c.Value
Next c
End With