PDA

View Full Version : Help with cell referencing



tonalator15
06-22-2009, 10:00 AM
Hi

I am new to this forum and am currently having trouble with VBA. I am trying to have my code go to the worksheet that is in the formula of another cell.

Example:

='Sheet1'!$A$1

I would like to be able to go to "Sheet1" and then select data from that sheet using more VBA code. Is there a way to follow the reference in a cell?

Thanks for any help in advance!

Bob Phillips
06-22-2009, 10:55 AM
Is it always a simple formula of that construct, or could it be more complex?

tonalator15
06-22-2009, 11:08 AM
I don't think I will need to look at anything more complex than the example I gave.

rbrhodes
06-22-2009, 05:09 PM
Hi t,

This is a very basic construct that you may be able to get some knowledge from (or at least some questions!)

It uses 'Instr', 'Len', 'Mid' and 'Right' functions to strip the various values from the original formula.

I've also included an example of how to access the sheet data without selecting (activating) the other sheet. The example uses 'Copy' with the optional 'Destination' argument

Too much fun!

mikerickson
06-22-2009, 05:19 PM
Perhaps something like
With Selection
.ShowPrecedents
.NavigateArrow True, 1, 1
.ShowPrecedents Remove:=True
End With

tonalator15
06-23-2009, 12:07 PM
thanks for your help, i got it to work!

Aussiebear
06-23-2009, 03:14 PM
Care to show us how you managed to get it to work?