View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1075_] Simon Lloyd[_1075_] is offline
external usenet poster
 
Posts: 1
Default Add a message to this array.


Maybe add an Else to your IF like this:
Public Sub TestRanges() 'Sort or Modify columns Macro
Dim mBox As Variant
Dim Nxt As Variant
Nxt:
Sheets("Rockwell").Select
NamedRanges = Array("Scl1", "Scl2", "Scl3", "Scl4", "Scl5", "Scl6",
"Scl7", "Scl8", "Scl9", "Scl10")
For Each NRange In NamedRanges
Set isect = Application.Intersect(Range(NRange), ActiveCell)
If Not isect Is Nothing Then
Worksheets("Rockwell").Select
Load Rckwll
Rckwll.Show
Unload Rckwll
Exit For
Else
mBox = MsgBox("You have not selected a range", vbYesNo, "Range not
detected")
If mBox = vbYes Then GoTo Nxt
End If
Next NRange
End Sub


Rookie 1st class;289973 Wrote:
Public Sub TestRanges() 'Sort or Modify columns Macro
Sheets("Rockwell").Select
NamedRanges = Array("Scl1", "Scl2", "Scl3", "Scl4", "Scl5", "Scl6",
"Scl7", "Scl8", "Scl9", "Scl10")
For Each NRange In NamedRanges
Set isect = Application.Intersect(Range(NRange), ActiveCell)
If Not isect Is Nothing Then
Worksheets("Rockwell").Select
Load Rckwll
Rckwll.Show
Unload Rckwll
Exit For
End If
Next NRange
End Sub

Thanks to Joel for this code. It works great provided I select one of
the
"Scls". I'd like to add a message that tells the user what to do if one
of
the Scls isn't selected.
TIA
Lou



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=81040