BarefootPaul
New Member
I posted this on the MrExcel forum and haven't gotten any responses. I'll try to frame the problem better here. I have a set of userforms that enters information about a client three different times with the second two searching the worksheet ("Clients") for a matching value in column C. If the value of a Text Box matches a value in that column then it updates cells in the corresponding row. It worked last week and I don't know what changed or why it isn't working. Here is the 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. Please return to main screen and enter a referral before returning to update client's admission status.")
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
'
I am hoping someone can point out why the code isn't working or what I might be missing. What happens right now is that it always gives me the MsgBox, even when I copy the value from a cell in column C into the txtMaineCare txtbox.
Thanks for you time,
BarefootPaul
'
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. Please return to main screen and enter a referral before returning to update client's admission status.")
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
'
I am hoping someone can point out why the code isn't working or what I might be missing. What happens right now is that it always gives me the MsgBox, even when I copy the value from a cell in column C into the txtMaineCare txtbox.
Thanks for you time,
BarefootPaul