Results 1 to 2 of 2

combo box displays values from a list drawn from spreadsheet

Threaded View

  1. #1
    Registered User
    Join Date
    04-14-2011
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    39

    combo box displays values from a list drawn from spreadsheet

    Hi guys,

    Just experimenting using a combo box to display a list of values from a tab but keep running into a problem. I've attached the file. Please go to the code window and test run the userform1.

    Dim rng As Range
    Dim ws As Worksheet
    Dim lastrowAP As Integer
    
    Set ws = Worksheets("List of medications")
    
    lastrowAP = Worksheets("List of medications").Range("A:A").SpecialCells(xlCellTypeLastCell).Row
    
    For Each rng In ws.Range("A2:" & lastrowAP)
    
    Me.combobox1.AddItem rng.Value
    Next rng
    When I run it, it says Method range of object failed error...

    Can anybody help me with this? I think the logic makes sense, which is set variables, find the last row in col A, then make a loop that starts from top to lastrow??

    Thanks
    Attached Files Attached Files
    Last edited by lifeseeker1019; 10-16-2014 at 09:18 PM. Reason: added sample file

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Fill combo box list based on other combo box values
    By rain4uu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2013, 03:04 PM
  2. [SOLVED] Combo box selection displays textboxes or hides them, help please.
    By RTR97 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-06-2012, 12:31 PM
  3. Replies: 2
    Last Post: 11-02-2011, 10:55 AM
  4. Copy Combo Box list to spreadsheet
    By BJ5352 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2011, 07:59 PM
  5. [SOLVED] Combo box in Excel that displays 2 columns
    By ichu05 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-21-2006, 04:32 PM

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