I'm really feeling stupid right now because I can't figure out why I can't set a range to RowCount. I've used a similar code elsewhere without any problems. Any feedback would be appreciated.
Private Sub cmdbutMakeEdit_Click()
Dim RowCount As Range
Dim RowCell As Integer
Dim EditDrug As String
Dim ws As Worksheet
Dim ws3 As Worksheet
Set ws = Worksheets("Sheet1")
Set ws3 = Worksheets("Sheet3")
EditDrug = ws3.Cells(1, 1).Value
Set RowCount = Worksheets("Sheet1").Range("D1:D10000").Find(EditDrug, lookat:=xlPart) <----this keeps coming back as nothing
RowCell = RowCount.Row
If Not RowCount Is Nothing Then
RowCell = RowCount.Row
ws.Cells(RowCell + 10, 7).Value = txtboxDose.Value
ws.Cells(RowCell + 10, 8).Value = cboRoute.Value
ws.Cells(RowCell + 10, 9).Value = cboFrequency.Value
MsgBox "Medication has been edited"
End If
Me.txtboxDose.Enabled = False
Me.txtboxDose.Visible = False
Me.txtboxDose.Value = ""
Me.cboRoute.Enabled = False
Me.cboRoute.Visible = False
Me.cboFrequency.Enabled = False
Me.cboFrequency.Visible = False
Me.cboAdditionalDrugInfo.Enabled = False
Me.cboAdditionalDrugInfo.Visible = False
Me.cboPage1Meds.Value = ""
End Sub
Bookmarks