Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default cell reference in another workbook

if i have workbook1 open can i reference a cell value in
a different workbook that is closed (workbook2).

so if i had:

Private Sub CommandButton1_Click()
workbook1.sheets("Sheet1").range("A1").value = _
workbook2.sheets("sheet1").range("Q98").value
End Sub
would something like this work?
i am not sure on the syntax of referencing a different
workbook.

i am actually tring to import a range of workbook2 into
workbook1. or more specifically copy a range from 1
into 2. TIA...S
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default cell reference in another workbook

Private Sub CommandButton1_Click()
With workbook1.sheets("Sheet1").range("A1")
.Formula = "=" & _
"'C:\Folder\[workbook2.xls]Sheet1'!Q98"
.Formula = .Value
End With
End Sub

Linking to a closed workbook is more easily done through Excel. VBA doesn't
support it.

--
Regards,
Tom Ogilvy


spence wrote in message
...
if i have workbook1 open can i reference a cell value in
a different workbook that is closed (workbook2).

so if i had:

Private Sub CommandButton1_Click()
workbook1.sheets("Sheet1").range("A1").value = _
workbook2.sheets("sheet1").range("Q98").value
End Sub
would something like this work?
i am not sure on the syntax of referencing a different
workbook.

i am actually tring to import a range of workbook2 into
workbook1. or more specifically copy a range from 1
into 2. TIA...S



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't click on cell to reference to another workbook reallytryingtogetworkdone Excel Worksheet Functions 1 January 7th 08 09:44 PM
workbook/cell reference w/ formula waladd Excel Worksheet Functions 4 February 17th 07 03:16 PM
How to reference a cell in a different workbook using a drop down Mr. C Excel Discussion (Misc queries) 0 January 15th 07 05:31 AM
Use the value of a cell within a reference to another workbook? MR Excel Worksheet Functions 1 August 1st 06 05:41 PM
cell reference in another workbook Corben Excel Discussion (Misc queries) 3 April 29th 06 10:03 AM


All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"