PDA

View Full Version : Addition of cells as path



joshua1990
09-21-2017, 04:48 AM
Hey guys!

How is it possible to access tables or cells inside tables, if they are not specified directly as a path?
So the path for the file forms itself from file> table> cell
If these three elements are now separated into 3 cells, how is it possible to combine them and declare them as a reference or as a path?

With the help of = A1 + A2 + A3 I can not go any further.
(A1 = file, A2=tbl, A3=cell)


With best regards.

SamT
09-21-2017, 07:47 AM
Depends, IS this Path going to be used in an Excel Worksheet Formula Or as a Variable in a VBA Procedure?

You have the right idea ( A1 + A2 + A3) but you have to add in all the " notations" required.

For example. Square brackets, quotes, dots, exclamation points, slashes, file extensions, etc


For VBA. A1 is File, A2 is Sheet name, and A3 is Cell Address

FullPath = $Path & "\" & Sheets(1).Range(a1) & ".xlsm" & "!Sheets(" & Sheets(1).Range(a2) & ").Range(" & Sheets(1).Range(a3) & ")"
C:/Book1.xlsm!Sheets("Sheet1").Range("A1") YMMV