Cityroller
New Member
- Joined
- Oct 17, 2017
- Messages
- 6
I am creating a spreadsheet in which I am able to click a control button to bring up a form to enter dates, amounts, etc. It was working. Then it stopped. I wish I knew exactly what I changed, but I started receiving the run-time 13, type mismatch error on the line that assigns application.caller to buttonPress. Application.caller brings up "Button 7," a string. I tried not declaring the variable buttonPress and received the same error.
Originally this worked. What am I missing? Thank you.
Originally this worked. What am I missing? Thank you.
Code:
Public whichButton As Integer, dataCell As Integer
Dim rowCount As Integer
Dim buttonNumber As String, buttonPress As String
Private Sub CommandButton1_Click()
If TextBox1.Value = "" Or TextBox2.Value = "" Or TextBox3 = "" Then
If MsgBox("Incomplete entry. Continue?", vbQuestion + vbYesNo) <> vbYes Then
Exit Sub
End If
End If
If TextBox1.Value > WorksheetFunction.EoMonth(e2, 0) Then
MsgBox ("Exceeds current month.")
Call resetForm
debitBox.Show
Exit Sub
End If
If Not IsNumeric(TextBox1) Or Not IsNumeric(TextBox2) Then
MsgBox ("Needs a number")
Call resetForm
debitBox.Show
Exit Sub
End If
If Len(TextBox3) > 11 Then
MsgBox ("Comment too long")
Call resetForm
debitBox.Show
Exit Sub
End If
buttonPress = Application.Caller
buttonNumber = Mid(buttonPress, 8, 2)
whichButton = CInt(buttonNumber)
Call enterData
Call resetForm
debitBox.Hide
End Sub
Last edited by a moderator: