Re : Va chercher donnee
Bonjour le forum,
j'ai un petit souci, avec la macro ci dessous, j'ai le retour suivant : #VALEUR! ce qui doit etre normal puisse-qu'il y a un =SOMMEPROD. ma colonne est en alpha numérique !
Tout la macro de masterdisco me convient sauf, que finalement je dois rapporter une valeur.
ci joint le fichier.
cordialement,
Sub Table()
Dim c As Range, imax As Integer, BaseLastRow As Integer
Dim Tab_Base_Col1 As String, Tab_Base_Col2 As String, Tab_Base_Col3 As String
With Sheets("base")
BaseLastRow = .Cells(Rows.Count, 1).End(xlUp).Row
Tab_Base_Col1 = "base!" & .Range(.Cells(2, 1), .Cells(BaseLastRow, 1)).Address
Tab_Base_Col2 = "base!" & .Range(.Cells(2, 2), .Cells(BaseLastRow, 2)).Address
Tab_Base_Col3 = "base!" & .Range(.Cells(2, 3), .Cells(BaseLastRow, 3)).Address
End With
With Sheets("va chercher")
If .[b1].Value = "Réponse" Then .[b1].EntireColumn.Delete
imax = .Cells(.Rows.Count, 1).End(xlUp).Row
.Columns("B:B").Insert Shift:=xlToRight
.Range("B1").Value = "Réponse"
formule = "=SOMMEPROD((" & Tab_Base_Col1 & "=$A2)*(" & Tab_Base_Col2 & "=$C2)*" & Tab_Base_Col3 & ")"
.Range("B2").FormulaLocal = formule
.Range("B2").AutoFill Destination:=.Range("b2:b" & imax), Type:=xlFillDefault
End With
End Sub