Reading Data From Series of External Workbooks

  • Thread starter Thread starter Marston
  • Start date Start date
M

Marston

I have an application I've written that pulls data from several other
workbooks in order to perform some calculations.

Right now I have it set up where I make very specific definitions
in the VB code:

Set Range = Worksheets("NamedWorkbook").Range("NamedRange")

However, this is very cumbersome because it requires too much manipulation
How can I alter my code so that users can be queried for what workbook/range
combinations match a particular request without having to name the range.

Perferable, I'd what the user to just input the name of the workbook and the
appropriate corresponding range.
 
Marston,

Maybe a form with comboboxes for Workbook name and for Range???
Helps prevent typos...
 
Look in help for Application.Inputbox( Type:=8)

This allows the user to select a range with the mouse.

Dim rng as Range
set rng = nothing
On Error Resume Next
set rng = Application.InputBox("Select range with mouse", Type:=8)
On Error goto 0
if rng is nothing then
msgbox "You didn't select a range, exiting"
exit sub
End if
msgbox "You selected: " & rng.Address(0,0,External:=True)
 
Back
Top