Run-time error '13': Type mismatch ??

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
574
Office Version
  1. 365
Platform
  1. Windows
I am getting a Run-time error '13': Type mismatch flag on the code line listed below. I do not know why it is failing at this point. The data is all formatted as Number so the data format is the same. I am at a loss as to why this is failing. Any support or direction is appreciated.

Code:
'   Transfer Investigation tP90 data from Data History to PMI Data Transfer.


    Workbooks(Home1).Activate
    Sheets("PMI Data History").Select
    Range("BG300000").Select 
    Selection.End(xlUp).Select
    If ActiveCell.Row < 9 Then
        If ActiveCell.Row = 2 Then
            Sheets("PMI Data Transfer").Range("BN3").Value = 0   'TOTAL data
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BO3").Value = 0   'Item 1
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BP3").Value = 0   'Item 2
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BQ3").Value = 0   'Item 3
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BR3").Value = 0   'Item 4
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BS3").Value = 0   'Item 5
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BT3").Value = 0   'Item 6
           
        ElseIf ActiveCell.Row > 2 And ActiveCell.Row < 9 Then
        
            Sheets("PMI Data Transfer").Range("BN3").Value = 0   'TOTAL data
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BO3").Value = 0   'Item 1
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BP3").Value = 0   'Item 2
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BQ3").Value = 0   'Item 3
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BR3").Value = 0   'Item 4
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BS3").Value = 0   'Item 5
            ActiveCell.Offset(0, 1).Select
            Sheets("PMI Data Transfer").Range("BT3").Value = 0   'Item 6
        
        End If
        
    ElseIf ActiveCell.Value <> "" Then
    
        Sheets("PMI Data Transfer").Range("BN3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value  'TOTAL data
        ActiveCell.Offset(0, 1).Select
        Sheets("PMI Data Transfer").Range("BO3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value   'Item 1
        ActiveCell.Offset(0, 1).Select
        Sheets("PMI Data Transfer").Range("BP3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value    'Item 2
        ActiveCell.Offset(0, 1).Select
        Sheets("PMI Data Transfer").Range("BQ3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value    'Item 3
        ActiveCell.Offset(0, 1).Select
        Sheets("PMI Data Transfer").Range("BR3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value    'Item 4
        ActiveCell.Offset(0, 1).Select
        Sheets("PMI Data Transfer").Range("BS3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value    'Item 5
        ActiveCell.Offset(0, 1).Select
        Sheets("PMI Data Transfer").Range("BT3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value    'Item 6
        
    
    End If

The code fails on the following line and gives me the run-time error 13

Code:
[B][COLOR=#FF0000]       
[/COLOR][/B]Sheets("PMI Data Transfer").Range("BN3").Value = ActiveCell.Value - ActiveCell.Offset(-7, 0).Value  'TOTAL data[B][COLOR=#FF0000]
[/COLOR][/B]

This should all work fine as far as I am concerned, but I am no professional by any means. Thanks for all the help.

Robert
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Robert

Have you checked which cell, on which worksheet, in which workbook ActiveCell is referring to when you get the error?

Also, have you checked its value and the value of the cell 7 rows up from it?
 
Upvote 0
Thanks for the heads up on this one. I was simply counting back 7 days and should have only counted 6 to get me data from the current day. All good to go now. Have a great day Norie, I appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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