![]() |
link in excel macro
I have an excel macro that needs to get data from a different worksheet. I
can add a link successfully in in my workbook that grabs data from another workbook, but I dont know the context in the vb editor can anyone help me?? -- matt |
link in excel macro
This should get you started:
Sub test() Dim myWS As Worksheet Dim aWS As Worksheet Set aWS = ActiveSheet Set myWS = Nothing On Error Resume Next Set myWS = Worksheets("Sheet2") On Error GoTo 0 If Not myWS Is Nothing Then 'Reference cells in myWS aWS.Cells(1, 1) = myWS.Cells(1, 1) '<~~~change this as needed End If End Sub HTH, Barb Reinhardt "matt" wrote: I have an excel macro that needs to get data from a different worksheet. I can add a link successfully in in my workbook that grabs data from another workbook, but I dont know the context in the vb editor can anyone help me?? -- matt |
link in excel macro
Thanks Barb - you're the greatest!!! Im still new at this and you just got me
through this! -- matt "Barb Reinhardt" wrote: This should get you started: Sub test() Dim myWS As Worksheet Dim aWS As Worksheet Set aWS = ActiveSheet Set myWS = Nothing On Error Resume Next Set myWS = Worksheets("Sheet2") On Error GoTo 0 If Not myWS Is Nothing Then 'Reference cells in myWS aWS.Cells(1, 1) = myWS.Cells(1, 1) '<~~~change this as needed End If End Sub HTH, Barb Reinhardt "matt" wrote: I have an excel macro that needs to get data from a different worksheet. I can add a link successfully in in my workbook that grabs data from another workbook, but I dont know the context in the vb editor can anyone help me?? -- matt |
All times are GMT +1. The time now is 04:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com