Please look at the code below...as you can see I am matching data in column A with column B.....A1 to B1, A2 to B2, etc....and then when the data doesn't match it displays an error box and doesn't go any further.........only problem with the way i know how to do it is, I dont want to copy this code 400 times for 400 lines of data.......I know there's a much better way.....can anyone help??!!??
THANKS!
Kyle
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("data").Select
Dim msg As String
Range("a3").Select
If ActiveCell.Value <> Range("b3").Value Then
msg = "Problem starting at " & ActiveCell.Value & " on data."
MsgBox msg
Else
Range("a4").Select
If ActiveCell.Value <> Range("b4").Value Then
msg = "Problem starting at " & ActiveCell.Value & " on data."
MsgBox msg
Else
Range("a5").Select
If ActiveCell.Value <> Range("b5").Value Then
msg = "Problem starting at " & ActiveCell.Value & " on data."
MsgBox msg
THANKS!
Kyle
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("data").Select
Dim msg As String
Range("a3").Select
If ActiveCell.Value <> Range("b3").Value Then
msg = "Problem starting at " & ActiveCell.Value & " on data."
MsgBox msg
Else
Range("a4").Select
If ActiveCell.Value <> Range("b4").Value Then
msg = "Problem starting at " & ActiveCell.Value & " on data."
MsgBox msg
Else
Range("a5").Select
If ActiveCell.Value <> Range("b5").Value Then
msg = "Problem starting at " & ActiveCell.Value & " on data."
MsgBox msg