Runtime Error 13: Type Mismatch
Solved
Belinos
Posted messages
15
Status
Membre
-
yg_be Posted messages 23437 Registration date Status Contributeur Last intervention -
yg_be Posted messages 23437 Registration date Status Contributeur 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 réponses
yg_be
Posted messages
23437
Registration date
Status
Contributeur
Last intervention
Ambassadeur
1 587
Hello,
does the error occur when you only change cell C7?
does the error occur when you change just one cell?
does the error occur when you only change cell C7?
does the error occur when you change just one cell?
Belinos
Posted messages
15
Status
Membre
No, the error occurs anywhere on the sheet.
yg_be
Posted messages
23437
Registration date
Status
Contributeur
Last intervention
1 587
>
Belinos
Posted messages
15
Status
Membre
I didn't understand "move a cell on my sheet": how do you do that?
Belinos
Posted messages
15
Status
Membre
>
yg_be
Posted messages
23437
Registration date
Status
Contributeur
Last intervention
Well, I select the frame of a cell and move it to another location.
yg_be
Posted messages
23437
Registration date
Status
Contributeur
Last intervention
1 587
>
Belinos
Posted messages
15
Status
Membre
Ah ok, you copy the content of a cell to neighboring cells!