Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

CTRL-End me retourne trop loint dans la feuille

4 réponses
Avatar
pellet15
Bonjour =E0 tous=20

Lorsque je fait CTRL-End

cela ma retourne compl=E8tement a la fin de la feuille ( IV65536 )
mais ma derni=E8re cellule devrais =EAtre ( AI54 )

J'ai ex=E9cuter les deux macros:

Sub R=E9initUsedRange()
ActiveSheet.UsedRange
End Sub
_______________________________
et
__________________________
Sub Nettoie()
Dim Sht As Worksheet, DCell As Range, Calc As Long, Rien As String
On Error Resume Next
Calc =3D Application.Calculation
With Application
.Calculation =3D xlCalculationManual
.StatusBar =3D "Nettoyage en cours..."
.EnableCancelKey =3D xlErrorHandler
.ScreenUpdating =3D False
End With
For Each Sht In Worksheets
If Sht.UsedRange.Address <> "$A$1" Or Not IsEmpty(Sht.[A1]) Then
Set DCell =3D Sht.Cells.Find("*", , , , xlByRows, xlPrevious)(2)
If Not DCell Is Nothing Then
Sht.Range(DCell, Sht.Cells([A:A].Count, 1)).EntireRow.Clear
Set DCell =3D Nothing
Set DCell =3D Sht.Cells.Find("*", , , , xlByColumns, xlPrevious)(, =
2)
If Not DCell Is Nothing Then _
Sht.Range(DCell, Sht.[IV1]).EntireColumn.Clear
End If
Rien =3D Sht.UsedRange.Address
End If
Next Sht
Application.StatusBar =3D False
Application.Calculation =3D Calc
End Sub


et rien ne change.

Comment corriger car mon fichier est un peu volumineux

Merci

4 réponses

Avatar
DanielCo
Bonjour,
A mon avis, le plus simple est de recopier la plage A1:AI54 dans une feuille
vierge, d'ajuster éventuellement la largeur des colonneset la hauteur des
lignes. Recopier les macros de la feuille s'il y en a et de supprimer la
feuille initiale.
Cordialement.
Daniel
pellet15 a formulé ce mardi :
Bonjour à tous

Lorsque je fait CTRL-End

cela ma retourne complètement a la fin de la feuille ( IV65536 )
mais ma dernière cellule devrais être ( AI54 )

J'ai exécuter les deux macros:

Sub RéinitUsedRange()
ActiveSheet.UsedRange
End Sub
_______________________________
et
__________________________
Sub Nettoie()
Dim Sht As Worksheet, DCell As Range, Calc As Long, Rien As String
On Error Resume Next
Calc = Application.Calculation
With Application
.Calculation = xlCalculationManual
.StatusBar = "Nettoyage en cours..."
.EnableCancelKey = xlErrorHandler
.ScreenUpdating = False
End With
For Each Sht In Worksheets
If Sht.UsedRange.Address <> "$A$1" Or Not IsEmpty(Sht.[A1]) Then
Set DCell = Sht.Cells.Find("*", , , , xlByRows, xlPrevious)(2)
If Not DCell Is Nothing Then
Sht.Range(DCell, Sht.Cells([A:A].Count, 1)).EntireRow.Clear
Set DCell = Nothing
Set DCell = Sht.Cells.Find("*", , , , xlByColumns, xlPrevious)(, 2)
If Not DCell Is Nothing Then _
Sht.Range(DCell, Sht.[IV1]).EntireColumn.Clear
End If
Rien = Sht.UsedRange.Address
End If
Next Sht
Application.StatusBar = False
Application.Calculation = Calc
End Sub


et rien ne change.

Comment corriger car mon fichier est un peu volumineux

Merci
Avatar
MichD
Bonjour,

Exécute cette macro une fois.

'---------------------------------------------------------------------------------------------
Sub test()'MichD
Dim Sh As Worksheet, DerLig As Long, DerCol As Integer
Dim ModeCalcul As String

Application.ScreenUpdating = False
ModeCalcul = Application.Calculation
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
On Error Resume Next
For Each Sh In ThisWorkbook.Worksheets
With Sh
If Not IsEmpty(.UsedRange) Then
DerLig = .Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

DerCol = .Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
.Range(.Cells(1, DerCol + 1), .Cells(.Rows.Count, .Columns.Count)).Delete
.Range(.Cells(DerLig + 1, 1), .Cells(.Rows.Count, .Columns.Count)).Delete
End If
End With
If Err <> 0 Then Err = 0
Next
Application.Calculation = ModeCalcul
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
'---------------------------------------------------------------------------------------------
Avatar
pellet15
Le mardi 22 décembre 2015 10:09:02 UTC-5, pellet15 a écrit :
Bonjour à tous

Lorsque je fait CTRL-End

cela ma retourne complètement a la fin de la feuille ( IV65536 )
mais ma dernière cellule devrais être ( AI54 )

J'ai exécuter les deux macros:

Sub RéinitUsedRange()
ActiveSheet.UsedRange
End Sub
_______________________________
et
__________________________
Sub Nettoie()
Dim Sht As Worksheet, DCell As Range, Calc As Long, Rien As String
On Error Resume Next
Calc = Application.Calculation
With Application
.Calculation = xlCalculationManual
.StatusBar = "Nettoyage en cours..."
.EnableCancelKey = xlErrorHandler
.ScreenUpdating = False
End With
For Each Sht In Worksheets
If Sht.UsedRange.Address <> "$A$1" Or Not IsEmpty(Sht.[A1]) Then
Set DCell = Sht.Cells.Find("*", , , , xlByRows, xlPrevious)(2)
If Not DCell Is Nothing Then
Sht.Range(DCell, Sht.Cells([A:A].Count, 1)).EntireRow.Clear
Set DCell = Nothing
Set DCell = Sht.Cells.Find("*", , , , xlByColumns, xlPrevious)( , 2)
If Not DCell Is Nothing Then _
Sht.Range(DCell, Sht.[IV1]).EntireColumn.Clear
End If
Rien = Sht.UsedRange.Address
End If
Next Sht
Application.StatusBar = False
Application.Calculation = Calc
End Sub


et rien ne change.

Comment corriger car mon fichier est un peu volumineux

Merci



Bonjour MichD

cela a fonctionner sur 6 onglet et
une onglet que les lignes (AI65536) et
un autre que la colonne (IV2972)

le fichier est passer de 3 900 a 3 709 Ko

Merci
Avatar
riribouldingue1
Le mercredi 23 décembre 2015 17:08:04 UTC+1, pellet15 a écrit :
Le mardi 22 décembre 2015 10:09:02 UTC-5, pellet15 a écrit :
> Bonjour à tous
>
> Lorsque je fait CTRL-End
>
> cela ma retourne complètement a la fin de la feuille ( IV65536 )
> mais ma dernière cellule devrais être ( AI54 )
>
> J'ai exécuter les deux macros:
>
> Sub RéinitUsedRange()
> ActiveSheet.UsedRange
> End Sub
> _______________________________
> et
> __________________________
> Sub Nettoie()
> Dim Sht As Worksheet, DCell As Range, Calc As Long, Rien As String
> On Error Resume Next
> Calc = Application.Calculation
> With Application
> .Calculation = xlCalculationManual
> .StatusBar = "Nettoyage en cours..."
> .EnableCancelKey = xlErrorHandler
> .ScreenUpdating = False
> End With
> For Each Sht In Worksheets
> If Sht.UsedRange.Address <> "$A$1" Or Not IsEmpty(Sht.[A1]) Then
> Set DCell = Sht.Cells.Find("*", , , , xlByRows, xlPrevious)(2)
> If Not DCell Is Nothing Then
> Sht.Range(DCell, Sht.Cells([A:A].Count, 1)).EntireRow.Clear
> Set DCell = Nothing
> Set DCell = Sht.Cells.Find("*", , , , xlByColumns, xlPrevious )(, 2)
> If Not DCell Is Nothing Then _
> Sht.Range(DCell, Sht.[IV1]).EntireColumn.Clear
> End If
> Rien = Sht.UsedRange.Address
> End If
> Next Sht
> Application.StatusBar = False
> Application.Calculation = Calc
> End Sub
>
>
> et rien ne change.
>
> Comment corriger car mon fichier est un peu volumineux
>
> Merci

Bonjour MichD

cela a fonctionner sur 6 onglet et
une onglet que les lignes (AI65536) et
un autre que la colonne (IV2972)

le fichier est passer de 3 900 a 3 709 Ko

Merci



Bonjour,
Une solution manuelle que j'utilisai dans le temps :
- se positionner après la dernière colonne (dont on est sur) soit derni ère colonne + 1 = sélectionner les colonnes jusqu'à extrême droit e est supprimer
- Idem pour les lignes
- enregistrer le doc et DANS le temps cela fonctionnait.