+ Reply to Thread
Results 1 to 2 of 2

Button action based on drop down list value

Hybrid View

  1. #1
    Registered User
    Join Date
    02-27-2018
    Location
    Poland
    MS-Off Ver
    Office 2013
    Posts
    3

    Button action based on drop down list value

    I've got a sheet where if a particular value is chosen from drop down list some cells are filled with vlookup value. Despite filling in some cells with the formula I would like it to change the action of existing button.

    The button is supposed to open a file, and different file should be opened based on the drop down list value (the file that is being used in the vlookup formula).

    Is it possible in excel with a button or another solution is necessary?

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

    Re: Button action based on drop down list value

    - place all 3 files in the same folder
    - open the masterfile (enabling macros)
    - cell A1 should already contain the correct path to the files
    - select either Lookup1 or Lookup2 in cell B1 and click RUN
    - values in B2 to B5 will change

    Code is in the sheet module
    Private Sub ChangeLookup(ByVal Target As Range)
    Dim fPath As String:        fPath = ThisWorkbook.Path & "\"
    Dim wb
    With Target
        wb = .Value
        If .Address = "$B$1" And wb <> "Choose" Then
                wb = fPath & wb & ".xlsx"
                Set wb = Workbooks.Open(wb)
                wb.Close False
        End If
    End With
    End Sub
    
    Private Sub CommandButton1_Click()
        ChangeLookup Range("B1")
    End Sub
    Attached Files Attached Files
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

+ 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. Display action list or comments based on cell value
    By smsmworld in forum Excel General
    Replies: 26
    Last Post: 09-15-2016, 04:07 PM
  2. Dynamic Button based on Slide Bar Action
    By DM2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2015, 04:13 PM
  3. Populate Drop-down list based on selection from previous drop-down list
    By Diventus in forum Excel - New Users/Basics
    Replies: 14
    Last Post: 01-11-2013, 10:55 AM
  4. Populate Drop-down list based on selection from previous drop-down list
    By poison_stone in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 12-11-2012, 06:10 PM
  5. [SOLVED] Macro to detect radio button selected and perform action based on selectoin
    By Kistler in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-27-2012, 01:57 AM
  6. Action List Based on Yes/No answers.
    By emmarky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2010, 05:53 PM
  7. Perform action based on choice from validation list
    By kjetiltb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-05-2009, 04:57 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