i'm trying to create a code that will allow me to check if i match on the column A and C both condition "Car" and "Red" if yes i want to fill my existing DicoRedCar with the Brand of the Car as item and Price as Key here is my code :
Sub Dicofill()
Dim DicoRedCar As Object
Set DicoRedCar = CreateObject("Scripting.Dictionary")
Dim Startcell As Range
Set Startcell = Data.Range("A1")
i = i + 1
If Startcell.Offset(i, 0).Value = "Car" And Startcell.Offset(i, 2).Value = "Red"
Then DicoRedCar.Add Startcell.Offset(i, 0).Value, Startcell.Offset(i, 1).Value
End if
End Sub
column 1 vehicule type column 2 brand of the car column 3 Color of the car Column 6 Price of the car
but it does not feed the Dico i know that on range A24 i have a red car appearing but nothing happens i tried to check with a MsgBox for the Then Statement but it gave me nothing i tried this but nothing happened
If Startcell.Offset(i, 0).Value = "Car" And Startcell.Offset(i, 2).Value = "Red" Then
Msgbox("found a Red Car")
end if
so i think that the blocking point came first from my " if then " statements
thanks you for your help
Aucun commentaire:
Enregistrer un commentaire