Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Sheet Selection using a Ranged index

Hi,

How do I write code to perform a simple sheet selection based upon a listbox
box selection?

My listbox equals a range in an excel sheet.

Once the user has selected the relevant item in the list the cell link the
sheet produces the relevant index number.

How do I then use this index number to go to a predefined sheet based upon
the cell link reference.

Index =
A B C
D
1
Title Code Tile Name Start Year
1 IJCLAW International Journal of Constitional Law 2003
2 JFINEC Journal of Financial Econometrics 2003
3 JICJUS Journal of International Criminal Justice 2003


The cell link at the moment = 1, ie B1. How do I get it to then select the
sheet which using the B1 value is equal to corresponding Title Code? In this
case IJCLAW?

Thanks
Matt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Sheet Selection using a Ranged index

worksheets(Activesheet.Range("B1")).Select

--
Regards,
Tom Ogilvy



"Matthew Balch" wrote:

Hi,

How do I write code to perform a simple sheet selection based upon a listbox
box selection?

My listbox equals a range in an excel sheet.

Once the user has selected the relevant item in the list the cell link the
sheet produces the relevant index number.

How do I then use this index number to go to a predefined sheet based upon
the cell link reference.

Index =
A B C
D
1
Title Code Tile Name Start Year
1 IJCLAW International Journal of Constitional Law 2003
2 JFINEC Journal of Financial Econometrics 2003
3 JICJUS Journal of International Criminal Justice 2003


The cell link at the moment = 1, ie B1. How do I get it to then select the
sheet which using the B1 value is equal to corresponding Title Code? In this
case IJCLAW?

Thanks
Matt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Sheet Selection using a Ranged index

Thanks Tom.

Ive used this and works well. But it works in the order of the sheets in the
workbook. How do I get it to select the relevant sheet dependant on an index,

eg.

Cell Link = 5 (Say Cell B1)

This list is in an excel sheet:-

Column A Column B

Cell Link Index Nos Sheet Name
1 ABC1
2 ABC2
3 ABC3
4 ABC4
5 ABC5

So depending on the cell link, B1, (5) I would like it to select sheet 'ABC5'

Cheers
Matt

"Tom Ogilvy" wrote:

worksheets(Activesheet.Range("B1")).Select

--
Regards,
Tom Ogilvy



"Matthew Balch" wrote:

Hi,

How do I write code to perform a simple sheet selection based upon a listbox
box selection?

My listbox equals a range in an excel sheet.

Once the user has selected the relevant item in the list the cell link the
sheet produces the relevant index number.

How do I then use this index number to go to a predefined sheet based upon
the cell link reference.

Index =
A B C
D
1
Title Code Tile Name Start Year
1 IJCLAW International Journal of Constitional Law 2003
2 JFINEC Journal of Financial Econometrics 2003
3 JICJUS Journal of International Criminal Justice 2003


The cell link at the moment = 1, ie B1. How do I get it to then select the
sheet which using the B1 value is equal to corresponding Title Code? In this
case IJCLAW?

Thanks
Matt

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Sheet Selection using a Ranged index

Used this fine. But would like the sheet to be selected from a list in a
sheet without it being predetermined by the order of the actual sheets.

Perhaps tackle the problem another way?

I have a list box, displaying all my titles. For each of those titles I have
a seperate sheet within the workbook, in no order. How do I select that
worksheet which has been selected in the list?

This is where Ive been trying to use an index within a sheet to guide the
navigation of this. The cell link being to key.

E.g. Cell link = B5 which in turn equals number 5 in the list

In my index on my sheet I have

Column A Column B

Cell Link Ref Sheet Name
1 ABC1
2 ABC2
3 ABC3
4 ABC4
5 ABC5

So in this case I would like it to select Sheet ABC5

How do I do this?


I know this is probably a bad way of doing it but I dont know anyother ways
other than through pure VB (i.e. using the coded name of the sheets as
opposed to the pyhsical name) which I know very little of and would struggle
hugely.

Cheers
Matt




"Tom Ogilvy" wrote:

worksheets(Activesheet.Range("B1")).Select

--
Regards,
Tom Ogilvy



"Matthew Balch" wrote:

Hi,

How do I write code to perform a simple sheet selection based upon a listbox
box selection?

My listbox equals a range in an excel sheet.

Once the user has selected the relevant item in the list the cell link the
sheet produces the relevant index number.

How do I then use this index number to go to a predefined sheet based upon
the cell link reference.

Index =
A B C
D
1
Title Code Tile Name Start Year
1 IJCLAW International Journal of Constitional Law 2003
2 JFINEC Journal of Financial Econometrics 2003
3 JICJUS Journal of International Criminal Justice 2003


The cell link at the moment = 1, ie B1. How do I get it to then select the
sheet which using the B1 value is equal to corresponding Title Code? In this
case IJCLAW?

Thanks
Matt

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Sheet Selection using a Ranged index

assume your table (as shown in your post) is on Sheet3, starting in A1 with
no headers.

=vlookup(B5,Sheet3!A1:b5,2,False)

will return the sheet name. In code you can use this like

Dim res as Variant
res = Application.Vlookup(Activesheet.Range("B5"), _
Worksheets("Sheet3").Range("A1:B5"),2,False)
if not iserror(res) then
worksheets(res).Select
Else
msgbox "Match not made"
End if

--
Regards,
Tom Ogilvy




"Matthew Balch" wrote:

Used this fine. But would like the sheet to be selected from a list in a
sheet without it being predetermined by the order of the actual sheets.

Perhaps tackle the problem another way?

I have a list box, displaying all my titles. For each of those titles I have
a seperate sheet within the workbook, in no order. How do I select that
worksheet which has been selected in the list?

This is where Ive been trying to use an index within a sheet to guide the
navigation of this. The cell link being to key.

E.g. Cell link = B5 which in turn equals number 5 in the list

In my index on my sheet I have

Column A Column B

Cell Link Ref Sheet Name
1 ABC1
2 ABC2
3 ABC3
4 ABC4
5 ABC5

So in this case I would like it to select Sheet ABC5

How do I do this?


I know this is probably a bad way of doing it but I dont know anyother ways
other than through pure VB (i.e. using the coded name of the sheets as
opposed to the pyhsical name) which I know very little of and would struggle
hugely.

Cheers
Matt




"Tom Ogilvy" wrote:

worksheets(Activesheet.Range("B1")).Select

--
Regards,
Tom Ogilvy



"Matthew Balch" wrote:

Hi,

How do I write code to perform a simple sheet selection based upon a listbox
box selection?

My listbox equals a range in an excel sheet.

Once the user has selected the relevant item in the list the cell link the
sheet produces the relevant index number.

How do I then use this index number to go to a predefined sheet based upon
the cell link reference.

Index =
A B C
D
1
Title Code Tile Name Start Year
1 IJCLAW International Journal of Constitional Law 2003
2 JFINEC Journal of Financial Econometrics 2003
3 JICJUS Journal of International Criminal Justice 2003


The cell link at the moment = 1, ie B1. How do I get it to then select the
sheet which using the B1 value is equal to corresponding Title Code? In this
case IJCLAW?

Thanks
Matt



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Sheet Selection using a Ranged index

Thank you Tom. Excellent.



"Tom Ogilvy" wrote:

assume your table (as shown in your post) is on Sheet3, starting in A1 with
no headers.

=vlookup(B5,Sheet3!A1:b5,2,False)

will return the sheet name. In code you can use this like

Dim res as Variant
res = Application.Vlookup(Activesheet.Range("B5"), _
Worksheets("Sheet3").Range("A1:B5"),2,False)
if not iserror(res) then
worksheets(res).Select
Else
msgbox "Match not made"
End if

--
Regards,
Tom Ogilvy




"Matthew Balch" wrote:

Used this fine. But would like the sheet to be selected from a list in a
sheet without it being predetermined by the order of the actual sheets.

Perhaps tackle the problem another way?

I have a list box, displaying all my titles. For each of those titles I have
a seperate sheet within the workbook, in no order. How do I select that
worksheet which has been selected in the list?

This is where Ive been trying to use an index within a sheet to guide the
navigation of this. The cell link being to key.

E.g. Cell link = B5 which in turn equals number 5 in the list

In my index on my sheet I have

Column A Column B

Cell Link Ref Sheet Name
1 ABC1
2 ABC2
3 ABC3
4 ABC4
5 ABC5

So in this case I would like it to select Sheet ABC5

How do I do this?


I know this is probably a bad way of doing it but I dont know anyother ways
other than through pure VB (i.e. using the coded name of the sheets as
opposed to the pyhsical name) which I know very little of and would struggle
hugely.

Cheers
Matt




"Tom Ogilvy" wrote:

worksheets(Activesheet.Range("B1")).Select

--
Regards,
Tom Ogilvy



"Matthew Balch" wrote:

Hi,

How do I write code to perform a simple sheet selection based upon a listbox
box selection?

My listbox equals a range in an excel sheet.

Once the user has selected the relevant item in the list the cell link the
sheet produces the relevant index number.

How do I then use this index number to go to a predefined sheet based upon
the cell link reference.

Index =
A B C
D
1
Title Code Tile Name Start Year
1 IJCLAW International Journal of Constitional Law 2003
2 JFINEC Journal of Financial Econometrics 2003
3 JICJUS Journal of International Criminal Justice 2003


The cell link at the moment = 1, ie B1. How do I get it to then select the
sheet which using the B1 value is equal to corresponding Title Code? In this
case IJCLAW?

Thanks
Matt

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
Named ranged selection problem Martin B Excel Worksheet Functions 3 January 4th 08 09:32 PM
Index on a selection [KiO] ASamarcos Excel Programming 3 August 15th 06 11:30 PM
First row in Selection range (first index of a cell) EXCEL VBA [email protected] Excel Worksheet Functions 1 March 20th 06 09:38 PM
Index of Cells in a selection Rod[_6_] Excel Programming 4 November 16th 03 10:35 AM
Index of cells in a selection Rod[_6_] Excel Programming 0 November 14th 03 09:01 PM


All times are GMT +1. The time now is 11:00 AM.

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

About Us

"It's about Microsoft Excel"