Reading Cells is the same workbook different tab

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get something to work and having a hard time any help is
appreciated.

I want to type a "tab" name in cell "A1", then in cell "B2" I want to return
the value in the "tab" specified for the cell specified. For example active
cell "A1" reads "tab" "sheet2", and in in cell "B2" returns the data (nember)
from sheet2 cell "K2" Below I think is a start:

=ActiveCell.Range(A1),value2,"K2"

but get an error when I put this into the cell?? any suggestions...
 
I'm confused.

Are you looking for function suggestion?

If yes, then I had this:
A1: Sheet2
A2: K2
A3: =indirect("'" & a1 & "'!" & a2)

To return the value from Sheet2!K2.

In code, I'd use:

dim myVal as variant
with worksheets("sheet1")
myval = worksheets(.range("a1").value).range(.Range("a2").value).value
.range("A3").value = myVal
end with

I didn't provide any validation for either of these.
 
Back
Top