Bonjour,
Je suis débutant en VBA, j'ai écrit un Macro et j'ai un soucis avec la ligne :
n = Sheets("feuil1").Range("L1").Value()
Elle me génère une erreur d'exécution 13 : Incompatibilité de type. Il faudrait je pense convertir la valeur en Integer mais je ne sais pas du tout comment faire cela.
Les cases L1 et L2 appelés contiennent des nombres entiers générés avec la fonction NBVAL
Voici mon code entier :
Private Sub MacroActualisation()
Application.Calculation = xlCalculationManual
'Application.ScreenUptading = False
Dim n As Integer
Dim p As Integer
n = Sheets("feuil1").Range("L1").Value()
p = Sheets("feuil1").Range("L2").Value()
Sheets("feuil1").Range("I4:O4").AutoFill Destination:=Sheets("feuil1").Range("I4:O" & (n + 3)), Type:=xlFillDefault
If p > n Then
Sheets("feuil1").Range("I" & (n + 4) & ":O" & (p + 3)).ClearContents
End If
Sheets("feuil1").ListObjects("T_1").Resize Range("$O$3:$O$" & (n + 3))
Sheets("feuil1").Range("I:O").Calculate
Application.Calculation = xlCalculationAutomatic
'Application.ScreenUptading = True
End Sub
Mon second problème est que j'aimerais réduire le temps d'exécution et pour cela j'ai ajouté les lignes
Application.Calculation = xlCalculationManual
Application.ScreenUptading = False
...
Application.Calculation = xlCalculationAutomatic
Application.ScreenUptading = True
Seulement la ligne Application.ScreenUptading = False me génère une erreur d'exécution 438 propriété ou méthode non gérée par cet objet