+ Reply to Thread
Results 1 to 7 of 7

Double if conditions to match then add to an existing dictionary

  1. #1
    Registered User
    Join Date
    01-11-2018
    Location
    Rio de Janeiro
    MS-Off Ver
    office 2007
    Posts
    2

    Question Double if conditions to match then add to an existing dictionary

    Hello there,

    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 :

    Please Login or Register  to view this content.
    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

    Please Login or Register  to view this content.
    so i think that the blocking point came first from my " if then " statements

    thanks you for your help
    Last edited by KAYABRFR; 01-11-2018 at 10:18 AM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,226

    Re: Double if conditions to match then add to an existing dictionary

    Welcome to the Forum.
    In future please view the forum rules before posting. Your post does not comply with rule #3.
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing.

    So do the following:
    Go to original post, Highlight your code and click the [#] button at the top of the post window.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Double if conditions to match then add to an existing dictionary

    Your tests are case-sensitive which could explain the problem (we can't see the data so it is hard to say!).
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Registered User
    Join Date
    01-11-2018
    Location
    Rio de Janeiro
    MS-Off Ver
    office 2007
    Posts
    2

    Re: Double if conditions to match then add to an existing dictionary

    Please Login or Register  to view this content.
    Last edited by KAYABRFR; 01-11-2018 at 10:45 AM.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Double if conditions to match then add to an existing dictionary

    There you are- the cells contain "red" and not "Red" as in the code. Use
    Please Login or Register  to view this content.
    to make everything the same case.

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Double if conditions to match then add to an existing dictionary

    Well deduced @xlnitwit

    @KAYABRFR
    - VBA and Excel are not always consistent - it can be confusing

    Type this formula in a cell in Excel - formula returns TRUE
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Run this VBA code - message box returns FALSE
    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Double if conditions to match then add to an existing dictionary

    Also quite rude to cross-post without links, especially when people are answering you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Dictionary or Scripting.Dictionary. Binding Referencing Dim-ing. Sub routines and Function
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-12-2016, 08:28 AM
  2. Dictionary - Using a dictionary of dictionaries to hold individual orders
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2015, 08:32 PM
  3. [SOLVED] If dictionary key exists add new item to existing item array
    By strud in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-25-2014, 01:54 PM
  4. [SOLVED] SUMPRODUCT with multiple items + double existing values
    By Armitage2k in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-28-2014, 02:21 AM
  5. [SOLVED] Weekly Sales moved to Master, if match conditions replace existing other wise new line
    By gwsampso in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-16-2013, 07:18 AM
  6. Replies: 2
    Last Post: 01-28-2012, 05:26 PM
  7. Can't open existing files by double-clicking.
    By Kirby in forum Excel General
    Replies: 4
    Last Post: 09-27-2005, 09:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1