+ Reply to Thread
Results 1 to 2 of 2

Change how to view data from excel database

Hybrid View

  1. #1
    Registered User
    Join Date
    04-10-2015
    Location
    Philippines
    MS-Off Ver
    Windows 7
    Posts
    1

    Change how to view data from excel database

    Good day to everyone,

    Being a total newbie to excel userforms, I followed an online tutorial to make the attached file below:

    picture_viewer.xlsm

    What it does is view data with pictures and another tab puts in new data and picture.

    What I want to do is replace the txtFileName into a combo box so I can choose the picture (and corresponding data) to view. I have been trying using a code like this (that I got from a different example) changing references to match the program but I keep getting a Runtime Error 424 Object required.

    Private Sub CommandButton1_Click()
    Dim ws As Worksheet
    Set ws = Worksheets("OPPEDCT")
    Dim cell As Range
    With Range("A6", Range("A404").End(xlUp))
    Set cell = .Find(ComboBox1.Value, LookIn:=xlValues)
    If ComboBox1.Value = "" Then
    MsgBox "Enter Physician Name"
    Unload Me
    End If
    End With

    Private Sub UserForm_Initialize()
    ComboBox1.SetFocus
    lastrow = Worksheets("OPPEDCT").UsedRange.Rows.Count
    OPPEForm.ComboBox1.ColumnCount = 1
    OPPEForm.ComboBox1.RowSource = "A6:A" & lastrow
    OPPEForm.ComboBox1.ListIndex = -1


    I want to learn. Any help/tip is greatly appreciated. TYVMIA

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change how to view data from excel database

    Hi Julius

    Welcome to the Forum!!!

    You have me confused...the Code in your Sample File does not resemble this Code you're attempting to modify
    Private Sub CommandButton1_Click()
    Dim ws As Worksheet
    Set ws = Worksheets("OPPEDCT")
    Dim cell As Range
    With Range("A6", Range("A404").End(xlUp))
    Set cell = .Find(ComboBox1.Value, LookIn:=xlValues)
    If ComboBox1.Value = "" Then
    MsgBox "Enter Physician Name"
    Unload Me
    End If
    End With
    
    Private Sub UserForm_Initialize()
    ComboBox1.SetFocus
    lastrow = Worksheets("OPPEDCT").UsedRange.Rows.Count
    OPPEForm.ComboBox1.ColumnCount = 1
    OPPEForm.ComboBox1.RowSource = "A6:A" & lastrow
    OPPEForm.ComboBox1.ListIndex = -1
    Please upload a Sample File with your REVISED Code so we can duplicate this error
    I keep getting a Runtime Error 424 Object required
    By the way, please wrap any Code you post in Code Tags.
    Last edited by jaslake; 04-16-2015 at 05:43 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. Excel power view with access database
    By udrizwow in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-09-2015, 08:20 AM
  2. Change Excel error #N/A to 0 in set ranges, due to no data in database
    By DonnaTrahan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2015, 11:08 AM
  3. Replies: 0
    Last Post: 04-20-2012, 12:36 AM
  4. external database to view in EXCEL format
    By mangyan in forum Excel General
    Replies: 0
    Last Post: 10-28-2005, 11:05 AM
  5. [SOLVED] How do i change my database to list view
    By m in forum Excel General
    Replies: 1
    Last Post: 05-26-2005, 05:15 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