Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Passing listindex to worksheet names

Greetings all,



I'm trying to use the listindex to select a Worksheet. I don't want to use
value to set the worksheet name as the list values can be too long.



Worksheets names are "MD Catch 1", "MD Catch 2", "MD Catch 3", etc



I just can't figure how to pass the index+1 to the name property



Any hints would be greatly appreciated.





Sub Sheet_Selections()

'sets the worksheet to use

Wsht = Area_Selection.Which_Catchment.ListIndex + 1



'worksheet to use

Alpha = Worksheets("MD Catch 1")



'other code

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Passing listindex to worksheet names

Hi David,

You can use the Next property to return the next sheet object or any of its
properties, such as its name or index.

---
Regards,
Norman:

"David Adamson" wrote in message
...
Greetings all,



I'm trying to use the listindex to select a Worksheet. I don't want to

use
value to set the worksheet name as the list values can be too long.



Worksheets names are "MD Catch 1", "MD Catch 2", "MD Catch 3", etc



I just can't figure how to pass the index+1 to the name property



Any hints would be greatly appreciated.





Sub Sheet_Selections()

'sets the worksheet to use

Wsht = Area_Selection.Which_Catchment.ListIndex + 1



'worksheet to use

Alpha = Worksheets("MD Catch 1")



'other code

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Passing listindex to worksheet names

I'm not clear on the problem, but try:

Worksheets("MD Catch " & ListBox1.ListIndex + 1).Select

--

Vasant

"David Adamson" wrote in message
...
Greetings all,



I'm trying to use the listindex to select a Worksheet. I don't want to

use
value to set the worksheet name as the list values can be too long.



Worksheets names are "MD Catch 1", "MD Catch 2", "MD Catch 3", etc



I just can't figure how to pass the index+1 to the name property



Any hints would be greatly appreciated.





Sub Sheet_Selections()

'sets the worksheet to use

Wsht = Area_Selection.Which_Catchment.ListIndex + 1



'worksheet to use

Alpha = Worksheets("MD Catch 1")



'other code

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Passing listindex to worksheet names

Vasant,

That works a treat thankyou very much!

David


"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
I'm not clear on the problem, but try:

Worksheets("MD Catch " & ListBox1.ListIndex + 1).Select

--

Vasant



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Passing listindex to worksheet names

Dim Wsht as Long
Dim Alpha as Worksheet
'sets the worksheet to use

Wsht = Area_Selection.Which_Catchment.ListIndex + 1

'worksheet to use

Set Alpha = Worksheets(Wsht)

Alpha.Activate

--
Regards,
Tom Ogilvy


"David Adamson" wrote in message
...
Greetings all,



I'm trying to use the listindex to select a Worksheet. I don't want to

use
value to set the worksheet name as the list values can be too long.



Worksheets names are "MD Catch 1", "MD Catch 2", "MD Catch 3", etc



I just can't figure how to pass the index+1 to the name property



Any hints would be greatly appreciated.





Sub Sheet_Selections()

'sets the worksheet to use

Wsht = Area_Selection.Which_Catchment.ListIndex + 1



'worksheet to use

Alpha = Worksheets("MD Catch 1")



'other code

End Sub




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
Passing a WorkSheet from a Function??? Mac Lingo Excel Worksheet Functions 3 June 13th 06 08:29 AM
ListIndex Todd Huttenstine Excel Programming 2 May 13th 04 04:21 PM
Passing Selected Sheets' Names to a Macro John Tjia Excel Programming 5 December 24th 03 04:36 PM
ListIndex = cell value? Christy[_2_] Excel Programming 1 September 20th 03 03:19 PM
Passing a Variable from Worksheet to Workbook Susan Lammi Excel Programming 6 August 3rd 03 01:29 AM


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