Learning VB - run-time error '13' type mismatch On Show_Form line

jjriches

New Member
Joined
Jun 7, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am getting a "run-time error '13' type mismatch"

Debug: -

VBA Code:
Sub Show_Form()

    frmform.Show
   
End Sub

I cannot think of what I have done wrong.

COde: -

VBA Code:
Option Explicit

Sub Reset()

    Dim iRow As Long
    iRow = [Count(Database!A;A)] ' identify the last row
   
    With frmform
       
        .txtName.Value = ""
        .txtDate.Value = ""
        .txtTime.Value = ""
        .txtCustomer.Value = ""
        .txtSystem.Value = ""
        .txtCallout.Value = ""
       
        .cmbSeverity.Clear
        .cmbSeverity.AddItem "N/A"
        .cmbSeverity.AddItem "1"
        .cmbSeverity.AddItem "2"
        .cmbSeverity.AddItem "3"
        .cmbSeverity.AddItem "4"
               
        .txtProbNum.Value = ""
        .txtTimeSpent.Value = ""
        .txtDescription.Value = ""
        .txtAction.Value = ""
        .txtComments.Value = ""
       
        .lstCalloutDB.ColumnCount = 12
        .lstCalloutDB.ColumnHeads = True
       
        .lstCalloutDB.ColumnWidths = "60,60,60,60,60,60,60,60,60,60,60,60,"
       
    If iRow > 1 Then
       
        .lstCalloutDB.RowSource = "Call Out Log!A2:L" & iRow
    Else
   
        .lstCalloutDB.RowSource = "Call Out Log!A2:L2"
   
    End If
   
End With
   
End Sub



Sub Submit()

    Dim sh As Worksheet
    Dim iRow As Long
   
    Set sh = ThisWorkbook.Sheets("Call Out Log")
   
    iRow = [Counta(Call Out Log!A:A] + 1
   
    With sh
   
        .Cells(iRow, 1) = iRow - 1
       
        .Cells(iRow, 2) = frmform.txtName.Value
       
        .Cells(iRow, 3) = frmform.txtDate.Value
       
        .Cells(iRow, 4) = frmform.txtTime.Value
       
        .Cells(iRow, 5) = frmform.txtCustomer.Value
       
        .Cells(iRow, 6) = frmform.txtSystem.Value
       
        .Cells(iRow, 7) = frmform.txtCallout.Value
       
        .Cells(iRow, 8) = frmform.cmbSeverity.Value
       
        .Cells(iRow, 8) = frmform.txtProbNum.Value
       
        .Cells(iRow, 10) = frmform.txtTimeSpent.Value
       
        .Cells(iRow, 11) = frmform.txtDescription.Value
       
        .Cells(iRow, 12) = frmform.txtAction.Value
       
        .Cells(iRow, 12) = frmform.txtComments.Value
   
   
    End With
   
End Sub

Sub Show_Form()

    frmform.Show
   
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi & welcome to MrExcel.
If you go into the Vb Editor & click Tools, Options, General then check the "Break in class modules" option, that will allow the code to run & highlight the line that is causing the problem.

However you have a problem in the Reset Sub. You should have a colon, not semi-colon on this line iRow = [Count(Database!A;A)] although it seems odd that you are calculating the lastrow on the database sheet, but using it on the Call Out Log sheet.
 
Upvote 0
Thanks @Fluff.....

A classic "newby" problem.... :)

I'll look at the next problem its highlighted..... I may be back :biggrin:
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top