+ Reply to Thread
Results 1 to 3 of 3

Link Problem Can a MAcro do this?

  1. #1
    Registered User
    Join Date
    04-20-2005
    Posts
    52

    Link Problem Can a MAcro do this?

    HI All

    I need to change a worksheet in the link I have created.

    eg

    In Cell A1 formula is:

    =('C:\data\worksheets\team\[quality Scores.xls]Jan'!B2)

    What I want to do is have a drop down list by Mth in B1 which will dynamically change the Worksheet name to whatever month is selected in B1.

    So if B1 = Mar

    Then A1 will chnage to:
    =('C:\data\worksheets\team\[quality Scores.xls]Mar'!B2)

    So could I do this via a macro somehow.

    The external workbook will be closed and needs to update this workbook with all the current data.

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Hi Mike,

    you could enter this code in the sheet module where you would enter the month in cell B1

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$1" Then
    Range("A1") = "='C:\data\worksheets\team\[quality Scores.xls]" & Target.Value & "'!B2"
    End If
    End Sub


    Mangesh

  3. #3
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    And if you want a combobox instead, then select a combobox from the control toolbox (View > Toolsbars. select the control toolbox) and not the forms menu. The name of this combobox would be ComboBox1. Then enter the following code in the module of the concerned sheet.


    Private Sub Worksheet_Activate()
    ComboBox1.LinkedCell = "Sheet1!B1"
    ComboBox1.ListFillRange = "Sheet1!J1:J12"
    End Sub

    Private Sub ComboBox1_Change()
    Range("A1") = "='D:\[quality Scores.xls]" & ComboBox1.Value & "'!B2"
    End Sub


    Mangesh

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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