BarefootPaul
Board Regular
- Joined
- Jul 21, 2011
- Messages
- 54
I wrote this code to search for a value in a column and then update the corresponding columns in that row, based on data entered into a userform. I swear it worked last week and now it isn't. Here is the code:
It is suppossed to search column C until it finds the match, but even though I can can see that it is a match, it keeps telling me there is no match and the MsgBox to enter a referral comes up. Any suggestions would be helpful.
Thanks,
BarefootPaul
Code:
Private Sub cmdUpdate_Click()
ActiveWorkbook.Sheets("Clients").Activate
Range("C1").Select
Do
If ActiveCell.Value <> txtMaineCare.Value Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = txtMaineCare.Value Or ActiveCell.Value = ""
If ActiveCell.Value = "" Then
MsgBox ("There is no referral for this client.")
Else
ActiveCell.Offset(0, 9) = txtDOA.Value
ActiveCell.Offset(0, 10) = cboResProgram.Value
ActiveCell.Offset(0, 11) = cboPlacingAgency.Value
If cboPlacingAgency.Value = "Other (specify)" Then
txtPlaceOther.Enabled = True
txtPlaceOther.SetFocus
ActiveCell.Offset(0, 12) = txtPlaceOther.Value
End If
ActiveCell.Offset(0, 13) = txtGAFAdmit.Value
ActiveCell.Offset(0, 14) = txtDischargePlan.Value
End If
Range("C1").Select
End Sub
It is suppossed to search column C until it finds the match, but even though I can can see that it is a match, it keeps telling me there is no match and the MsgBox to enter a referral comes up. Any suggestions would be helpful.
Thanks,
BarefootPaul