Hi Guys
i have a bit of code that loops through a number of rows then looks for the information and changes a bit of data
when the selection is not found it errors out with error 91
i have added an error trap but it dont work any ideas
Public Sub AddMissingAlpha()
Dim strvalue As String
Dim strAlpha As Double
Dim strRowNo As Integer
Sheets("Missing_Alpha").Select
Range("A1").Select
On Error GoTo 50
Do Until ActiveCell.Offset(1, 0).Value = ""
DoEvents
ActiveCell.Offset(1, 0).Select
strvalue = ActiveCell.Value
strAlpha = ActiveCell.Offset(0, 1).Value
Sheets("Data").Select
Columns("A:A").Select
If Selection.Find(what:=strvalue).Activate = True Then
strRowNo = ActiveCell.Row
If Range("U" & strRowNo).Value = "" Then
Range("U" & strRowNo).Value = strAlpha
End If
End If
50
Sheets("Missing_Alpha").Select
Loop
End Sub
i have a bit of code that loops through a number of rows then looks for the information and changes a bit of data
when the selection is not found it errors out with error 91
i have added an error trap but it dont work any ideas
Public Sub AddMissingAlpha()
Dim strvalue As String
Dim strAlpha As Double
Dim strRowNo As Integer
Sheets("Missing_Alpha").Select
Range("A1").Select
On Error GoTo 50
Do Until ActiveCell.Offset(1, 0).Value = ""
DoEvents
ActiveCell.Offset(1, 0).Select
strvalue = ActiveCell.Value
strAlpha = ActiveCell.Offset(0, 1).Value
Sheets("Data").Select
Columns("A:A").Select
If Selection.Find(what:=strvalue).Activate = True Then
strRowNo = ActiveCell.Row
If Range("U" & strRowNo).Value = "" Then
Range("U" & strRowNo).Value = strAlpha
End If
End If
50
Sheets("Missing_Alpha").Select
Loop
End Sub