Whenever I push "Save Donation" I an getting a Run-Time error '1004': Application-defined or object-defined error. I have looked over the code as well as go one by one through the text boxes to see if there was a mismatch in spelling or location. It references the sheet I am asking it to prior to saving it to pick the next row to save it too. I just don't know what to try next. I have highlighted in red where the error occurs and I removed that line during troubleshooting and the error just moves to the end line down. Any ideas? Hopefully I am just overlooking something small! Thanks in Advance!
Code:
Private Sub SaveDonation_Click()
SaveBasedOnDonerID
AddData
End Sub
Sub SaveBasedOnDonerID()
Dim Text As String
rowCounter = 1
DonorIDSaveColumn = 2
DateColumn = 3
TimeColumn = 4
ProcedureTypeColumn = 5
DonationSiteColumn = 6
DonorEmailColumn = 7
AddToDNCColumn = 8
DispositionColumn = 9
AgentIDColumn = 10
Do
DonorIDSaveText = ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, DonorIDSaveColumn).Value
If DonorIDSaveText <> "" Then
rowCounter = rowCounter + 1
ThisWorkbook.Sheets("Donation Info").Activate
Range("A2").Select
' Changing loopercell
ActiveCell.FormulaR1C1 = rowCounter
End If
Loop While DonorIDSaveText <> ""
End Sub
Function ValidateData() As Boolean
Dim Proceed As Boolean
Proceed = True
If DonorIDSave2TextBox.Value = "" Then
MsgBox "Please copy and paste Donor ID"
Proceed = False
End If
If Disposition2TextBox.Value = "" Then
MsgBox "Please Select a Disposition"
Proceed = False
End If
If AgentID2TextBox.Value = "" Then
MsgBox "Please fill in your Agent ID"
Proceed = False
End If
ValidateData = Proceed
End Function
Sub AddData()
DonorIDSaveColumn = 2
DateColumn = 3
TimeColumn = 4
ProcedureTypeColumn = 5
DonationSiteColumn = 6
DonorEmailColumn = 7
AddToDNCColumn = 8
DispositionColumn = 9
AgentIDColumn = 10
Dim Proceed As Boolean
Proceed = ValidateData
If Proceed = True Then
[COLOR=#ff0000] ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, DonorIDSaveColumn).Value = DonorIDSave2TextBox.Value[/COLOR]
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, DateColumn).Value = Date2TextBox.Value
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, TimeColumn).Value = Time2TextBox.Value
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, ProcedureTypeColumn).Value = ProcedureType2TextBox.Value
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, DonationSiteColumn).Value = donationsite2TextBox.Value
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, DonorEmailColumn).Value = DonorEmail2TextBox.Value
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, DispositionColumn).Value = Disposition2TextBox.Value
ThisWorkbook.Sheets("Donation Info").Cells(rowCounter, AgentIDColumn).Value = AgentID2TextBox.Value
End If
End Sub