ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Link Problem Can a MAcro do this? (https://www.excelbanter.com/excel-programming/331720-link-problem-can-macro-do.html)

Mikeice[_19_]

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 wil
dynamically change the Worksheet name to whatever month is selected i
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 workboo
with all the current data

--
Mikeic
-----------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...fo&userid=2246
View this thread: http://www.excelforum.com/showthread.php?threadid=37889


mangesh_yadav[_309_]

Link Problem Can a MAcro do this?
 

Hi Mike,

you could enter this code in the sheet module where you would enter th
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


Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=37889


mangesh_yadav[_310_]

Link Problem Can a MAcro do this?
 

And if you want a combobox instead, then select a combobox from th
control toolbox (View Toolsbars. select the control toolbox) and no
the forms menu. The name of this combobox would be ComboBox1. The
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


Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=37889



All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com