Runtime Error 13: Type Mismatch
Solved
Belinos
Posted messages
15
Status
Member
-
yg_be Posted messages 23437 Registration date Status Contributor Last intervention -
yg_be Posted messages 23437 Registration date Status Contributor Last intervention -
Hello,
As a beginner in VBA, I'm encountering a runtime error 13 at the line "If not application.intersect...".
Here is my code:
I added the initial part "Option Explicit and dim", but I still have an error every time I insert a line or move a cell on my sheet.
Thank you for your help!
Have a nice day!
As a beginner in VBA, I'm encountering a runtime error 13 at the line "If not application.intersect...".
Here is my code:
I added the initial part "Option Explicit and dim", but I still have an error every time I insert a line or move a cell on my sheet.
Option Explicit
Dim wsh As String
Dim sh As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("C7")) Is Nothing And Target <> "" Then
wsh = Target
With Worksheets(wsh)
.Visible = True
.Activate
End With
For Each sh In ThisWorkbook.Sheets
If sh.Name <> "Feuil1" And sh.Name <> "Feuil2" And sh.Name <> "Feuil3" And sh.Name <> "Feuil4" And sh.Name <> "Feuil5" And sh.Name <> "Feuil6" And sh.Name <> wsh Then
sh.Visible = xlVeryHidden
End If
Next
End If
End Sub
Thank you for your help!
Have a nice day!
4 answers
-
yg_be Posted messages 23437 Registration date Status Contributor Last intervention Ambassadeur 1 588
Hello,
does the error occur when you only change cell C7?
does the error occur when you change just one cell?