And another problem....
Excel 2000
I am using the below code to find and mark data over 2 pages - the 2nd page ("Sheet2" won't necessarily have data on it though...so I am getting an error message because the data can't be found on sheet2...the On Error Goto Nextstep works fine to skip this in the first half of code, but I cannot get any kind of error handler to work within the loop (Error stops at the c.Offset(0, 12).Select, with "select method of range class failed"...
I might be going about this in completely the wrong way - so any suggestions on tidying this up will be most welcome - the best way for me to learn!
Thanks in advance for your help
sub marksale ()
Dim strFindText As String
Sheets("Sheet1".Select
strFindText = InputBox("Please enter number of sale item", "Enter Number"
If strFindText = "" Then Exit Sub
On Error GoTo wrongrego
Sheets("Sheet1".Select
With Sheets("Sheet1".Range("d:d"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 13).Select
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
On Error GoTo nextstep
With Sheets("Sheet2".Range("a:a"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 12).Select
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
Sheets("Sheet1".Select
nextstep:
msg = "Would you like to mark another entry?"
ans = MsgBox(msg, vbYesNo, "Mark Other Entry"
Do Until ans = vbNo
Sheets("Sheet1".Select
strFindText = InputBox("Please enter number of sale item", "Enter Number"
If strFindText = "" Then Exit Sub
Sheets("Sheet1".Select
With Sheets("Sheet1".Range("d:d"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 13).Select
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
With Sheets("Sheet2".Range("a:a"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 12).Select 'error stops here
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
Sheets("Sheet1".Select
Application.ScreenUpdating = True
msg = "Would you like to mark another entry?"
ans = MsgBox(msg, vbYesNo, "Mark Other Entry"
End With
End With
Loop
Exit Sub
wrongrego:
MsgBox "You have entered invalid data, please try again", , "Invalid Data Entry"
I really appreciate your help - have been trying to figure this out for hours!
Excel 2000
I am using the below code to find and mark data over 2 pages - the 2nd page ("Sheet2" won't necessarily have data on it though...so I am getting an error message because the data can't be found on sheet2...the On Error Goto Nextstep works fine to skip this in the first half of code, but I cannot get any kind of error handler to work within the loop (Error stops at the c.Offset(0, 12).Select, with "select method of range class failed"...
I might be going about this in completely the wrong way - so any suggestions on tidying this up will be most welcome - the best way for me to learn!
Thanks in advance for your help
sub marksale ()
Dim strFindText As String
Sheets("Sheet1".Select
strFindText = InputBox("Please enter number of sale item", "Enter Number"
If strFindText = "" Then Exit Sub
On Error GoTo wrongrego
Sheets("Sheet1".Select
With Sheets("Sheet1".Range("d:d"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 13).Select
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
On Error GoTo nextstep
With Sheets("Sheet2".Range("a:a"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 12).Select
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
Sheets("Sheet1".Select
nextstep:
msg = "Would you like to mark another entry?"
ans = MsgBox(msg, vbYesNo, "Mark Other Entry"
Do Until ans = vbNo
Sheets("Sheet1".Select
strFindText = InputBox("Please enter number of sale item", "Enter Number"
If strFindText = "" Then Exit Sub
Sheets("Sheet1".Select
With Sheets("Sheet1".Range("d:d"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 13).Select
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
With Sheets("Sheet2".Range("a:a"
Set c = .FIND(strFindText, LookIn:=xlValues)
c.Offset(0, 12).Select 'error stops here
ActiveCell.FormulaR1C1 = "Sale"
Range(Selection, Cells(ActiveCell.Row, 1)).Select
Selection.Font.ColorIndex = 5
Sheets("Sheet1".Select
Application.ScreenUpdating = True
msg = "Would you like to mark another entry?"
ans = MsgBox(msg, vbYesNo, "Mark Other Entry"
End With
End With
Loop
Exit Sub
wrongrego:
MsgBox "You have entered invalid data, please try again", , "Invalid Data Entry"
I really appreciate your help - have been trying to figure this out for hours!