M
Mike K
Oh wise ones,
From the existing code below I crudely added some
error code from right out of the help section. The form would crap out to
debug mode if a valid red tag number was not entered. I just wanted it to
display a message and start the sub again. Now is displays a message but goes
to the next form and the data is put in the wrong cells. I would be shocked
if you guys took more the 3 seconds to fix this one. Please advise.
Thanks,
Mike
Sub Sup()
Dim Message, Title, Default, Squares
Dim closetag As Integer
On Error GoTo ErrorHandler<< I added this
Message = "Enter the red tag number that was reworked" ' Set
prompt.
Title = "Red Tag Number" ' Set title.
Default = "0" ' Set default.
closetag = InputBox(Message, Title, Default)
Worksheets("Closed Red Tags").Rows(4).Insert
Worksheets("Open Red Tags").Activate
With Worksheets("Open Red Tags").Range("a4:a500")
Set C = .Find(closetag, LookIn:=xlValues, LookAt:=xlWhole,
MatchByte:=True)
C.Select
Selection.Range("a1:k1").Cut
Worksheets("Closed Red Tags").Activate
Range("A4").Select
ActiveSheet.Paste
Worksheets("Closed Red Tags").Range("N4") = Date
Worksheets("Open Red Tags").Activate
Supervisor.Show
End With
Exit Sub << I added this
ErrorHandler: << I added this
MsgBox "Please enter a valid Redtag ID" << I added this
Resume Next << I added this
End Sub
From the existing code below I crudely added some
error code from right out of the help section. The form would crap out to
debug mode if a valid red tag number was not entered. I just wanted it to
display a message and start the sub again. Now is displays a message but goes
to the next form and the data is put in the wrong cells. I would be shocked
if you guys took more the 3 seconds to fix this one. Please advise.
Thanks,
Mike
Sub Sup()
Dim Message, Title, Default, Squares
Dim closetag As Integer
On Error GoTo ErrorHandler<< I added this
Message = "Enter the red tag number that was reworked" ' Set
prompt.
Title = "Red Tag Number" ' Set title.
Default = "0" ' Set default.
closetag = InputBox(Message, Title, Default)
Worksheets("Closed Red Tags").Rows(4).Insert
Worksheets("Open Red Tags").Activate
With Worksheets("Open Red Tags").Range("a4:a500")
Set C = .Find(closetag, LookIn:=xlValues, LookAt:=xlWhole,
MatchByte:=True)
C.Select
Selection.Range("a1:k1").Cut
Worksheets("Closed Red Tags").Activate
Range("A4").Select
ActiveSheet.Paste
Worksheets("Closed Red Tags").Range("N4") = Date
Worksheets("Open Red Tags").Activate
Supervisor.Show
End With
Exit Sub << I added this
ErrorHandler: << I added this
MsgBox "Please enter a valid Redtag ID" << I added this
Resume Next << I added this
End Sub