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

total des lignes visibles seulement / OK XL2000 erreur de compil XL97

6 réponses
Avatar
J
Bonjour à tous
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre
de méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:=883) etc
Comment l'adapter???
Merci pour l'aide :-)
amicalement
J@@


'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:=883)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:=884)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:=886)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:=887)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:=883)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:=884)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:=886)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:=887)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'===================================
'*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************

6 réponses

Avatar
RaMa
Bonsoir J@@

as tu vérifié les références?
décoches les "Manquant"
sinon MichDenis est dans les parages
Salutations
RaMa

"J@@" a écrit dans le message de news:
%
Bonjour à tous
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre de
méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:ˆ3) etc
Comment l'adapter???
Merci pour l'aide :-)
amicalement
J@@


'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'================================== > '*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************


Avatar
J
Bonjour Rama
tu veux dire quoi par "décoches les manquants"??
merci pour l'aide
@+
J@@

Bonsoir J@@

as tu vérifié les références?
décoches les "Manquant"
sinon MichDenis est dans les parages
Salutations
RaMa

"J@@"
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre de
méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:ˆ3) etc
Comment l'adapter???
Merci pour l'aide :-)
amicalement
J@@


'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'================================== >>'*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************







Avatar
MichDenis
Bonjour J@@,

Essaie cette syntaxe avec excel 97.... je ne l'ai pas testé mais ...!

Tu remplaces les 4 boucles de cette procédure
Sub ModifierCommandeAfficherMasquerLigneEtColonne

par ceci :

'-------------------------
With Application.CommandBars
.Item(1).FindControl(ID:ˆ3, Recursive:=True).OnAction = "MasquerLigne"
.Item(1).FindControl(ID:ˆ4, Recursive:=True).OnAction = "AfficherLigne"
.Item(1).FindControl(ID:ˆ6, Recursive:=True).OnAction = "MasquerColonne"
.Item(1).FindControl(ID:ˆ7, Recursive:=True).OnAction = "AfficherColonne"
.Item("Row").FindControl(ID:ˆ3, Recursive:=True).OnAction = "MasquerLigne"
.Item("Row").FindControl(ID:ˆ4, Recursive:=True).OnAction = "AfficherLigne"
.Item("Column").FindControl(ID:ˆ6, Recursive:=True).OnAction = "MasquerColonne"
.Item("Column").FindControl(ID:ˆ7, Recursive:=True).OnAction = "AfficherColonne"
End With
'-------------------------

Et il en est de même pour cette procédure :
Sub CommandeNORMALAfficherMasquerLigneEtColonne()

With Application.CommandBars
.Item(1).FindControl(ID:ˆ3, Recursive:=True).OnAction = ""
.Item(1).FindControl(ID:ˆ4, Recursive:=True).OnAction = ""
.Item(1).FindControl(ID:ˆ6, Recursive:=True).OnAction = ""
.Item(1).FindControl(ID:ˆ7, Recursive:=True).OnAction = ""
.Item("Row").FindControl(ID:ˆ3, Recursive:=True).OnAction = ""
.Item("Row").FindControl(ID:ˆ4, Recursive:=True).OnAction = ""
.Item("Column").FindControl(ID:ˆ6, Recursive:=True).OnAction = ""
.Item("Column").FindControl(ID:ˆ7, Recursive:=True).OnAction = ""
End With



Salutations!


"J@@" a écrit dans le message de news: %
Bonjour à tous
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre
de méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:ˆ3) etc
Comment l'adapter???
Merci pour l'aide :-)
amicalement
J@@


'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'================================== '*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************
Avatar
RaMa
Commence par réinitialiser ta macro puis
dans l'éditeur VBA tu sélectionnes Outils/Références
regarde la liste
si tu as des "Manquant" (c'est écrit comme ça) il doit y avoir une coche.
enlève là
Si tu n'as pas de "Manquant" je n'ai pas de réponse et attend un autre
chaland .

Cordialement
RaMa



"J@@" a écrit dans le message de news:

Bonjour Rama
tu veux dire quoi par "décoches les manquants"??
merci pour l'aide
@+
J@@

Bonsoir J@@

as tu vérifié les références?
décoches les "Manquant"
sinon MichDenis est dans les parages
Salutations
RaMa

"J@@"
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre
de méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:ˆ3) etc
Comment l'adapter???
Merci pour l'aide :-)
amicalement
J@@


'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'================================== >>>'*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************








Avatar
J
Bonjour Denis
cela marche impeccablement :-))
un grand merci
amicalement
J@@

Essaie cette syntaxe avec excel 97.... je ne l'ai pas testé mais ...!

Tu remplaces les 4 boucles de cette procédure
Sub ModifierCommandeAfficherMasquerLigneEtColonne
par ceci :

'-------------------------
With Application.CommandBars
.Item(1).FindControl(ID:ˆ3, Recursive:=True).OnAction = "MasquerLigne"
.Item(1).FindControl(ID:ˆ4, Recursive:=True).OnAction = "AfficherLigne"
.Item(1).FindControl(ID:ˆ6, Recursive:=True).OnAction = "MasquerColonne"
.Item(1).FindControl(ID:ˆ7, Recursive:=True).OnAction = "AfficherColonne"
.Item("Row").FindControl(ID:ˆ3, Recursive:=True).OnAction = "MasquerLigne"
.Item("Row").FindControl(ID:ˆ4, Recursive:=True).OnAction = "AfficherLigne"
.Item("Column").FindControl(ID:ˆ6, Recursive:=True).OnAction = "MasquerColonne"
.Item("Column").FindControl(ID:ˆ7, Recursive:=True).OnAction = "AfficherColonne"
End With
'-------------------------

Et il en est de même pour cette procédure :
Sub CommandeNORMALAfficherMasquerLigneEtColonne()

With Application.CommandBars
.Item(1).FindControl(ID:ˆ3, Recursive:=True).OnAction = ""
.Item(1).FindControl(ID:ˆ4, Recursive:=True).OnAction = ""
.Item(1).FindControl(ID:ˆ6, Recursive:=True).OnAction = ""
.Item(1).FindControl(ID:ˆ7, Recursive:=True).OnAction = ""
.Item("Row").FindControl(ID:ˆ3, Recursive:=True).OnAction = ""
.Item("Row").FindControl(ID:ˆ4, Recursive:=True).OnAction = ""
.Item("Column").FindControl(ID:ˆ6, Recursive:=True).OnAction = ""
.Item("Column").FindControl(ID:ˆ7, Recursive:=True).OnAction = ""
End With


"J@@"
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre
de méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:ˆ3) etc
Comment l'adapter???

'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'================================== > '*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************


Avatar
J
Re bonsoir Rama
merci pour ton explication.
dans références je n'ai que les 4 premières lignes cochées (sur la
machine en XL2K comme sur celle en XL97 d'ailleurs), mais rien n'est
noté "manquant"
Depuis, Denis est repassé par là et a proposé une modif qui fonctionne
au poil sur le 97.
Il ya tjrs de grands mystères!!
merci encore
@+
J@@

Commence par réinitialiser ta macro puis
dans l'éditeur VBA tu sélectionnes Outils/Références
regarde la liste
si tu as des "Manquant" (c'est écrit comme ça) il doit y avoir une coche.
enlève là
Si tu n'as pas de "Manquant" je n'ai pas de réponse et attend un autre
chaland .

"J@@"
tu veux dire quoi par "décoches les manquants"??

as tu vérifié les références?
décoches les "Manquant"
sinon MichDenis est dans les parages
"J@@"
le code de MichDenis fonctionne très bien sur XL2000, mais lorsque je
l'installe sur une machine en XL97 j'ai "Erreur de compilation : Membre
de méthode ou de donnée introuvable" pour FindControls dans les lignes
Application.CommandBars.FindControls(ID:ˆ3) etc
Comment l'adapter???


'**********************
'le code de TWB est en bas
'---------------------------------
Function SommeCelluleVisible(Rg As Range)
Application.Volatile
Dim T As Double, R As Range
For Each R In Rg.Rows
If R.Hidden = False Then
T = T + WorksheetFunction.Sum(R.Cells)
End If
Next
SommeCelluleVisible = T
End Function

'---------------------------------
Sub ModifierCommandeAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = "MasquerLigne"
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = "AfficherLigne"
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = "MasquerColonne"
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = "AfficherColonne"
Next
End Sub
'---------------------------------

Sub CommandeNORMALAfficherMasquerLigneEtColonne()
'Masquer les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ3)
C.OnAction = ""
Next
'Afficher les lignes
For Each C In Application.CommandBars.FindControls(ID:ˆ4)
C.OnAction = ""
Next

'Masquer les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ6)
C.OnAction = ""
Next
'Afficher les Colonnes
For Each C In Application.CommandBars.FindControls(ID:ˆ7)
C.OnAction = ""
Next
End Sub
'---------------------------------
Sub MasquerLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub AfficherLigne()
Application.ScreenUpdating = False
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Rows.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
Application.ScreenUpdating = True
End Sub
'---------------------------------
Sub MasquerColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = True
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
Sub AfficherColonne()
If TypeName(Selection) = "Range" Then
ActiveSheet.Unprotect
Selection.Columns.Hidden = False
ActiveSheet.Calculate
ActiveSheet.Protect
End If
End Sub
'---------------------------------
'**********************

'================================== >>>>'*************
' Dans ThisWorkBook
' pour calcul des cellules visibles seulement, voir code dans module std
'---------------------------
Private Sub Workbook_Activate()
Workbook_SheetActivate ActiveSheet
End Sub
'---------------------------
Private Sub Workbook_Deactivate()
CommandeNORMALAfficherMasquerLigneEtColonne
End Sub
'---------------------------
Sub Workbook_SheetActivate(ByVal Sh As Object)
'que pour la Feuil1
If Sh.Name = "Feuil1" Then
ModifierCommandeAfficherMasquerLigneEtColonne
Else
CommandeNORMALAfficherMasquerLigneEtColonne
End If
End Sub
'---------------------------
'*************