Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How do I retrieve the contents of a Cell from different sheets?

Hi,
I am trying to create a function that will take a Sheet Name and
location "A2" and return the contents of that cell.

Secondly I would like to create a function that will take a Sheet Name
and location "A2" and return the height of the cell.

Thanks - mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How do I retrieve the contents of a Cell from different sheets?

Function WhatsInIt(r1 As Range, r2 As Range) As Variant
WhatsIt = Sheets(r1.Value).Range(r2.Value).Value
End Function


Function HowTall(r1 As Range, r2 As Range) As Variant
HowTall = Sheets(r1.Value).Range(r2.Value).RowHeight
End Function

In an arbitrary worksheet, put:
Sheet1 in A1 and
Z100 in cell A2

Then =WhatsInIt(A1,A2) will return the contents of cell Z100 in Sheet1
and
=HowTall(A1,A2) will return the height of cell Z100 in Sheet1

--
Gary''s Student - gsnu2007g


"mike" wrote:

Hi,
I am trying to create a function that will take a Sheet Name and
location "A2" and return the contents of that cell.

Secondly I would like to create a function that will take a Sheet Name
and location "A2" and return the height of the cell.

Thanks - mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How do I retrieve the contents of a Cell from different sheets?

On Apr 1, 12:07*pm, Gary''s Student
wrote:
Function WhatsInIt(r1 As Range, r2 As Range) As Variant
WhatsIt = Sheets(r1.Value).Range(r2.Value).Value
End Function

Function HowTall(r1 As Range, r2 As Range) As Variant
HowTall = Sheets(r1.Value).Range(r2.Value).RowHeight
End Function

In an arbitrary worksheet, put:
Sheet1 in A1 and
Z100 in cell A2

Then =WhatsInIt(A1,A2) will return the contents of cell Z100 in Sheet1
and
=HowTall(A1,A2) will return the height of cell Z100 in Sheet1

--
Gary''s Student - gsnu2007g



Thanks!!
Is there a way to modify these functions so I can pass in the r1 and
r2 values directly instead of from a table? Thanks - mike

Function WhatsInIt(r1 As Range, r2 As Range) As Variant
WhatsIt =
Sheets(r1.Value).Range(r2.Value).Value <---
End Function

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How do I retrieve the contents of a Cell from different sheets?

Also how do you handle filenames with spaces. Thanks
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How do I retrieve the contents of a Cell from different sheets

We can make versions of the functions that use data directly rather than
getting the data from cells. For example:

=WhatsInIt2("Sheet3","Z100") instead of the original forms.

Check back tomorow for an update to this post.
--
Gary''s Student - gsnu2007g


"mike" wrote:

Also how do you handle filenames with spaces. Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename selected (highlighted) sheet with cell contents of sheets in cell A1 [email protected] Excel Programming 2 December 15th 06 08:41 AM
How to start recording a Macro & Retrieve the contents via Atomati VJ Excel Programming 0 October 16th 06 09:40 AM
Accessing sheets based on cell contents Mike Excel Worksheet Functions 3 August 25th 06 08:31 AM
How can I retrieve data from the same cell, from multiple sheets? Alex Costache Excel Worksheet Functions 1 August 1st 06 11:53 AM
Retrieve data from different sheets dannyboy213 Excel Discussion (Misc queries) 2 March 22nd 06 08:25 PM


All times are GMT +1. The time now is 11:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"