Assign a cell value (from another file) to a varieble

A

Alberto Ast

I have try too many things but it does not work.... need to pick up a value
from a cell and place it into a variable... I tried

myVal.Value = [FM Deviation Request R1.0.xls].Form.R2C17
myVal = AOS Deviation Request R1.0.xls.Sheets("AOS Form").Range("Q2").Value"
and many more but can not work.
 
J

Jacob Skaria

Dim myVal as Variant
Dim wb as Workbook

'For referring Open workbook
Set wb = Workbooks("workbookname.xls")

'To open a excel file and reference it
'Set wbBook = Workbooks.Open("<fullpath>\<filename.ext>")

myVal = wb.Sheets("Sheet1").Range("Q2").Value
Msgbox myVal

If this post helps click Yes
 
T

Tim Williams

myVal = workbooks("AOS Deviation Request R1.0.xls").WorkSheets("AOS
Form").Range("Q2").Value

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top