Results 1 to 30 of 30

My Code is missing data I need to catch

Threaded View

  1. #1
    Registered User
    Join Date
    10-19-2020
    Location
    Bristol, England
    MS-Off Ver
    365 (& 2013)
    Posts
    85

    My Code is missing data I need to catch

    There is probably a simple answer (but I'm still taking baby steps)


    I have load of data in a spread sheet and I'm trying to populate a combobox with all the site names for a given company (I have multiple instances of both the SiteNames in column A & the CompanyNames in column B)

    I can do this to populate the combobox


       For SiteNameRange = TotalRows To 3 Step -1
            
                If Range("A" & SiteNameRange) = CBOX_CompanyName.Value Then         
                    CBOX_SiteName.AddItem Range("B" & SiteNameRange)
    But this gives every site name for that company, including duplicates. I need to ignor them

    So I tried this

       For SiteNameRange = TotalRows To 3 Step -1
            
                If Range("A" & SiteNameRange) = CBOX_CompanyName.Value And Range("B" & SiteNameRange) <> Range("B" & SiteNameRange - 1) Then         
                    CBOX_SiteName.AddItem Range("B" & SiteNameRange)
    But due to dumb luck (million to one shots happen 9 times out of ten)

    The same site name is used on the company I need but also either side! so it skips all the entries. The combo box is empty.

    Capture.JPG

    Any suggestions on a better solution?
    Last edited by CMOT Dibbler; 12-30-2020 at 12:17 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Catch Data base on date
    By azbi in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 10-09-2019, 06:30 AM
  2. [SOLVED] trying to spearate data into two cells but there is a catch, its a formula answer
    By yobevas in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-09-2015, 10:28 AM
  3. catch data list & self genration number
    By avk in forum Access Programming / VBA / Macros
    Replies: 7
    Last Post: 02-14-2010, 03:52 PM
  4. I need to place a pause/delay in my code to allow my program to catch up
    By fionajane in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2009, 04:24 AM
  5. Try and Catch Code For Finding File
    By SEOT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2009, 11:35 PM
  6. How to write a condition to catch missing data
    By novice2430 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-24-2008, 08:38 AM
  7. Catch data validation change event Excel 2007
    By saucekorn69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2008, 08:38 AM

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