Bonjour,
J'ai un message overflow sur le code suivant.
Je ne comprends pas car apres lecture des messages du forum, j'ai pourtant passe mes variables en Long et toujours rien.
Auriez-vous une idee ?
Merci par avance pour votre aide.
Cdt,
J'ai un message overflow sur le code suivant.
Je ne comprends pas car apres lecture des messages du forum, j'ai pourtant passe mes variables en Long et toujours rien.
Auriez-vous une idee ?
Merci par avance pour votre aide.
Cdt,
Code:
Sub MyMacro()
Dim MaxColumn, MaxRow, MaxRow2 As Long
Dim z, y, x As Long
'Application.ScreenUpdating = False
Sheets("MySheet").Cells.Delete
Range("A28").CurrentRegion.Copy
Sheets("MySheet").Range("A1").PasteSpecial xlPasteAll
Sheets("MySheet").Select
MaxColumn = Range("IV2").End(xlToLeft).Column
For z = MaxColumn To 1 Step -1
If (Cells(1, z) <> "Reference") And (Cells(1, z) <> "Instrument type") Then
Columns(z).Delete Shift:=xlToLeft
End If
Next
MaxRow = Range("B65536").End(xlUp).Row
For y = MaxRow To 2 Step -1
If (Cells(y, 2) <> "Type A") And (Cells(y, 2) <> "Type B") And (Cells(y, 2) <> "Type C") Then
Rows(y).Delete Shift:=xlUp
End If
Next
MaxRow2 = Range("B65536").End(xlUp).Row
For x = MaxRow2 To 2 Step -1
If (Cells(x, 4) = 0) Then
Rows(x).Delete Shift:=xlUp
End If
Next
'Application.ScreenUpdating = True
End Sub