ptitb74
Messages postés2Date d'inscriptionmardi 9 juin 2009StatutMembreDernière intervention 9 juin 2009
-
9 juin 2009 à 10:41
ptitb74
Messages postés2Date d'inscriptionmardi 9 juin 2009StatutMembreDernière intervention 9 juin 2009
-
9 juin 2009 à 10:44
Bonjour,
J'ai créé une macro sous Excel qui va me servir à aller chercher des infos dans une autre feuille de mon classeur.
Deux problèmes apparaissent:
Impossible de définir la propriéte ColorIndex de la classe Font
pointage au niveau de: ActiveCell.Font.ColorIndex = 7
et Val1 = Left(ActiveCell.Value, 4) est une variable non défine
Je suis vraiment bloqué
Pouvez-vous m'aider svp?
Merci d'avance
Ci-dessous le code sous VB
Option Explicit
Public Intitulé As String, Adrs As String, AdrNum As String
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If ActiveCell.Value <> Empty Then
If Not Intersect(Range("D10:AD18"), Target) Is Nothing Then 'selection du tableau
Call RechercheInfo
Call MakePopup
CommandBars("Data Popup").ShowPopup
Cancel = True
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Range("D10:AD18"), Target) Is Nothing Then
Call Affiche_Infos
End If
End Sub
Sub MakePopup()
On Error Resume Next
CommandBars("Data Popup").Delete
On Error GoTo 0
With CommandBars.Add(Name:="Data Popup", Position:=msoBarPopup)
With .Controls.Add(Type:=msoControlButton)
.OnAction = "SelectMasque"
.FaceId = 264
.Caption = Intitulé & " - Poste:" & AdrNum
.TooltipText = Intitulé
End With
End With
End Sub
Sub RechercheInfo()
Val1 = Left(ActiveCell.Value, 4)
Set Ligne1 = FListe.Range("S2:S500").Find(What:= Val1, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False)
Intitulé = FListe.Cells(Ligne1.Row, 5)
Adrs = FListe.Cells(Ligne1.Row, 8)
AdrNum = Ligne1.Offset(0, -5)
End Sub
Sub Affiche_Infos()
Dim Texte1 As String, Texte2 As String, Texte3 As String, Texte4 As String, Texte5 As String, Texte6 As String, Texte7 As String, Texte8 As String, Texte9 As String, Texte10 As String, Texte11 As String, Texte12 As String, Texteplus As String
RTexte = Right(ActiveCell.Value, 6)