Run-time error '13: Type Mismatch

GoCavs

New Member
Joined
Jul 11, 2017
Messages
15
I am trying to do a dynamic "Hide Rows" function where if a certain cell in a row has any value a number "1" will populate the A cell of that row, an example would be if cell B11 has value A11 will be equal to "1"... What I had the macro doing was hiding all rows where A = ""

The code had been working for a long time but then out of nowhere I was hit with "Run-time error '13: Type Mismatch"

Code:
Option Explicit


Dim cel As Range, rng As Range


Sub Example()
     
    Set rng = Range("a1", Range("a65536").End(xlUp))
     
    For Each cel In rng
         
        If cel.Value = "0" Then
             
            cel.EntireRow.Hidden = True
             
        End If
         
    Next cel
     
End Sub

Any help would be greatly appreciated and if you are reading this thank you
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
When you get this error, click on debug and advise us which line of code is highlighted.
 
Upvote 0
I don't even get that, the error pops up, I click "OK" and then that's it, nothing is highlighted like usual... Sorry I can't be of more help there
 
Last edited:
Upvote 0
instead of clicking OK, click on debug. Can you post a picture of the error message. Also, your explanation does not relate to the code you are presenting. Please clarify
 
Last edited:
Upvote 0
Alan I want to thank you for your help, I was able to fix the issue, I had to make changes to the sheet and once I did that code worked again
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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