Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to get sheet from sheet name

Hi everyone

I am using Sheet3.Cells(1, 1) to get some value from Sheet3 but Sheet3
can change if i insert new sheets . So is there any function that
retruns worksheet if i provides the sheet name.

so instead of using

varaible = Sheet3.Cells(attRow, attCol)

i can use

Dim sheet , varaible
sheet = unknowFunciton("data sheet") ' "data sheet" is the name
of Sheet3
varaible = sheet.Cells(1, 1)


Regards
Amaninder Saini :)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to get sheet from sheet name

Generally people use the codename because it does not change.

" wrote:

Hi everyone

I am using Sheet3.Cells(1, 1) to get some value from Sheet3 but Sheet3
can change if i insert new sheets . So is there any function that
retruns worksheet if i provides the sheet name.

so instead of using

varaible = Sheet3.Cells(attRow, attCol)

i can use

Dim sheet , varaible
sheet = unknowFunciton("data sheet") ' "data sheet" is the name
of Sheet3
varaible = sheet.Cells(1, 1)


Regards
Amaninder Saini :)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default How to get sheet from sheet name

If you use Sheet3.Cells(1, 1) that means that you are using the codename
(the VBA name if you like), not the Excel name. As such it will not change
just by inserting new sheets, only if you change it in the VBIDE or by code.

You could always set a sheet variable

Dim sh As Worksheet

Set sh = Worksheets("Sheet3")

and then refer to sh later on.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ps.com...
Hi everyone

I am using Sheet3.Cells(1, 1) to get some value from Sheet3 but Sheet3
can change if i insert new sheets . So is there any function that
retruns worksheet if i provides the sheet name.

so instead of using

varaible = Sheet3.Cells(attRow, attCol)

i can use

Dim sheet , varaible
sheet = unknowFunciton("data sheet") ' "data sheet" is the name
of Sheet3
varaible = sheet.Cells(1, 1)


Regards
Amaninder Saini :)



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to get sheet from sheet name


hi man, Is this your mean.

SUB GETNAME()
FOR EACH SH IN ACTIVEWORKBOOK.WORKSHEETS
SH.NAME = SH.RANGE(\"A1\").VALUE
NEXT SH
END SUB


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=567427

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
excel sheet bootom half sheet goes behind top part of sheet rob Excel Worksheet Functions 2 January 17th 09 01:28 AM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
Copying cells from on sheet to another sheet (via sheet module) CRayF Excel Programming 6 September 20th 05 08:58 PM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Excel Programming 1 March 5th 04 09:10 AM


All times are GMT +1. The time now is 08:54 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"