msquared99
08-08-2012, 10:42 AM
My brain hurts from this. I have a UserForm where the person checks a box if the client has a particular service. On the spreadsheet (Sheet1) in cell D14 is the Service Name. I have up to 7 different services the user can check. If the CheckBox has been checked I want the name of the service to populate in a cell beginning in cell D15. One to all the services can be checked. My range is D15:D24.
I've tried several different lines of code and nothing works. In the code below I get Run Time Error 1004.
Thanks, for any help!
Private Sub cmdProcess_Click()
Dim emptyCell As Range
'Activate Sheet1, find the empty cell and if CheckBox is checked write the "Value" to the cell in Range D15:D24.
Sheets(1).Activate
emptyCell = WorksheetFunction.CountA(Range("D14:D")) + 1
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "Time Import"
If cbCashCards.Value = True Then Cells(emptyCell, 4).Value = "Cash Cards"
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "ESS"
If cbCashCards.Value = True Then Cells(emptyCell, 4).Value = "RPS Client"
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "ATEST Client"
If cbCashCards.Value = True Then Cells(emptyCell, 4).Value = "HRSC"
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "Hartford EP"
'Copies data from UserFrom into Sheet1
With Sheet1
.Range("B1").Value = Me.tbCOID.Value
.Range("D1").Value = Me.tbName.Value
.Range("H1").Value = Me.tbDate.Value
.Range("B3").Value = Me.tbEECount.Value
.Range("D3").Value = Me.tbHourlyEE.Value
.Range("F3").Value = Me.tbHourlyPer.Value
.Range("B5").Value = Me.tbRep.Value
.Range("B7").Value = Me.tbContact.Value
.Range("F7").Value = Me.tbContactNum.Value
.Range("B9").Value = Me.tbScore1.Value
.Range("B11").Value = Me.tbScore2.Value
.Range("D9").Value = Me.tbSurveyNotes.Value
.Range("F15").Value = Me.tbSalesForce.Value
.Range("B15").Value = Me.CbxPayroll.Value
.Range("B16").Value = Me.CbxCOBRA.Value
.Range("B17").Value = Me.CbxFSA.Value
.Range("B18").Value = Me.CbxEMS.Value
.Range("B19").Value = Me.CbxTLM.Value
.Range("B20").Value = Me.CbxBenexx.Value
End With
'Clear UserForm
End Sub
I've tried several different lines of code and nothing works. In the code below I get Run Time Error 1004.
Thanks, for any help!
Private Sub cmdProcess_Click()
Dim emptyCell As Range
'Activate Sheet1, find the empty cell and if CheckBox is checked write the "Value" to the cell in Range D15:D24.
Sheets(1).Activate
emptyCell = WorksheetFunction.CountA(Range("D14:D")) + 1
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "Time Import"
If cbCashCards.Value = True Then Cells(emptyCell, 4).Value = "Cash Cards"
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "ESS"
If cbCashCards.Value = True Then Cells(emptyCell, 4).Value = "RPS Client"
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "ATEST Client"
If cbCashCards.Value = True Then Cells(emptyCell, 4).Value = "HRSC"
If cbTime.Value = True Then Cells(emptyCell, 4).Value = "Hartford EP"
'Copies data from UserFrom into Sheet1
With Sheet1
.Range("B1").Value = Me.tbCOID.Value
.Range("D1").Value = Me.tbName.Value
.Range("H1").Value = Me.tbDate.Value
.Range("B3").Value = Me.tbEECount.Value
.Range("D3").Value = Me.tbHourlyEE.Value
.Range("F3").Value = Me.tbHourlyPer.Value
.Range("B5").Value = Me.tbRep.Value
.Range("B7").Value = Me.tbContact.Value
.Range("F7").Value = Me.tbContactNum.Value
.Range("B9").Value = Me.tbScore1.Value
.Range("B11").Value = Me.tbScore2.Value
.Range("D9").Value = Me.tbSurveyNotes.Value
.Range("F15").Value = Me.tbSalesForce.Value
.Range("B15").Value = Me.CbxPayroll.Value
.Range("B16").Value = Me.CbxCOBRA.Value
.Range("B17").Value = Me.CbxFSA.Value
.Range("B18").Value = Me.CbxEMS.Value
.Range("B19").Value = Me.CbxTLM.Value
.Range("B20").Value = Me.CbxBenexx.Value
End With
'Clear UserForm
End Sub