Do Loop Until
That only happens if first an existing name is chosen and then a new name is
subsequently chosen, as the nm variable still has the previous value (I
found this 'feature' very annoying personally). So you need to initialise it
each iteration of the loop
Sub AddLoadCase()
Do
Dim mynum
mynum = InputBox("ENTER Load Case Name", "Load Case Namer")
If mynum = "" Then
Exit Sub
End If
Dim nm As Name
Set nm = Nothing
On Error Resume Next
Set nm = ThisWorkbook.Names(mynum)
On Error GoTo 0
If Not nm Is Nothing Then
MsgBox "Name '" & mynum & "' already exists. Please Choose
Anther 'name'!"
End If
Loop Until nm Is Nothing
Range("AD2:AK4").Copy
Range("B1000").End(xlUp).Offset(3, 0).PasteSpecial
Range("B1000").End(xlUp).Offset(0, 0).Select
Range("B1000").End(xlUp).Offset(0, 0).Value = mynum
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Kevin O'Neill" wrote in message
ups.com...
Not quite working.
Isn't there a way to set bookmarks in your actual code, and then jump
back to them?
|