With statements
Sub demo()
With Workbooks("Book1").Worksheets("Sheet1")
v = .Range("A1").Value
MsgBox (v)
End With
End Sub
--
Gary's Student
" wrote:
Simple question...
My idea is that when the user clicks a commandbutton, a userform is
displayed that is pulling dat from 2 workbooks. I wanted to use a
with.range function to populate some of the data from another workbook.
In workbook1, I do have a named range referencing data in workbook2,
however, when VBA hits that with range statement, it errors out since
the worksheet isnt an internal worksheet.
Is there a way with the "with range" statement to reference another
workbook? That workbook is open.
TIA
DS
|