A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Select a worksheet



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2010, 11:22 PM posted to microsoft.public.excel.worksheet.functions
Phil
external usenet poster
 
Posts: 606
Default Select a worksheet

I'm using the below formula to determine the specific type of equipment from
a list named: database

=IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X$2,"De sktop",IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X $5,"Notebook","Error!!!!!!!"))

value of X2 = DSK and value of X5 = NBK

What I need help with is a way of using the value returned to automatically
open the relevant worksheet, ie: If "Desktop" is returned the Desktop
worksheet needs to open and if "Notebook" is returned the notebook worksheet
needs to open automatically. All worksheets are in the same workbook.
Ads
  #2  
Old June 6th, 2010, 03:24 AM posted to microsoft.public.excel.worksheet.functions
Max
external usenet poster
 
Posts: 8,574
Default Select a worksheet

Assuming your vlookup formula as posted is in cell X1,
you could place this in say, Y1:
=IF(X1"Error!!!!!!!",HYPERLINK("#"&CELL("address ",INDIRECT("'"&X1&"'!A1")),X1),"")
to produce a clickable hyperlink to the particular sheet returned by your
formula
Any worth? hit the YES below
--
Max
Singapore
---
"Phil" wrote:
I'm using the below formula to determine the specific type of equipment from
a list named: database

=IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X$2,"De sktop",IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X $5,"Notebook","Error!!!!!!!"))

value of X2 = DSK and value of X5 = NBK

What I need help with is a way of using the value returned to automatically
open the relevant worksheet, ie: If "Desktop" is returned the Desktop
worksheet needs to open and if "Notebook" is returned the notebook worksheet
needs to open automatically. All worksheets are in the same workbook.

  #3  
Old June 6th, 2010, 04:30 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Select a worksheet

Private Sub Worksheet_Calculate()
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("A1")
If .Value = "Desktop" Then
Sheets("Desktop").Select
ElseIf .Value = "Notebook" Then
Sheets("Notebook").Select
End If
End With
stoppit:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Edit the "A1" to suit.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP


On Sat, 5 Jun 2010 15:22:00 -0700, Phil
wrote:

I'm using the below formula to determine the specific type of equipment from
a list named: database

=IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X$2,"D esktop",IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$ X$5,"Notebook","Error!!!!!!!"))

value of X2 = DSK and value of X5 = NBK

What I need help with is a way of using the value returned to automatically
open the relevant worksheet, ie: If "Desktop" is returned the Desktop
worksheet needs to open and if "Notebook" is returned the notebook worksheet
needs to open automatically. All worksheets are in the same workbook.


  #4  
Old November 29th, 2010, 09:22 AM
rekhasein rekhasein is offline
Banned
 
First recorded activity by OfficeFrustration: Nov 2010
Posts: 8
Default

Quote:
Originally Posted by Gord Dibben View Post
Private Sub Worksheet_Calculate()
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("A1")
If .Value = "Desktop" Then
Sheets("Desktop").Select
ElseIf .Value = "Notebook" Then
Sheets("Notebook").Select
End If
End With
stoppit:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code". Copy/paste the code into that
sheet module.

Edit the "A1" to suit.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP


On Sat, 5 Jun 2010 15:22:00 -0700, Phil
wrote:

I'm using the below formula to determine the specific type of equipment from
a list named: database

=IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X$2,"De sktop",IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X $5,"Notebook","Error!!!!!!!"))

value of X2 = DSK and value of X5 = NBK

What I need help with is a way of using the value returned to automatically
open the relevant worksheet, ie: If "Desktop" is returned the Desktop
worksheet needs to open and if "Notebook" is returned the notebook worksheet
needs to open automatically. All worksheets are in the same workbook.
Iím setting up several comment boxes and have a macro to automatically bring up the comments. However, Iím doing this in several cells and itís become inconvenient to click on a different cell everytime I want to go to a new cell after typing in a comment box. Is there a way to get out of the comment box without using the mouse and/or clicking on another cell so I can go to another cell?
  #5  
Old April 18th, 2011, 12:33 PM
tarquinious tarquinious is offline
Experienced Member
 
First recorded activity by OfficeFrustration: Mar 2011
Posts: 34
Default

Quote:
Originally Posted by Phil View Post
I'm using the below formula to determine the specific type of equipment from
a list named: database

=IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X$2,"De sktop",IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X $5,"Notebook","Error!!!!!!!"))

value of X2 = DSK and value of X5 = NBK

What I need help with is a way of using the value returned to automatically
open the relevant worksheet, ie: If "Desktop" is returned the Desktop
worksheet needs to open and if "Notebook" is returned the notebook worksheet
needs to open automatically. All worksheets are in the same workbook.
I don't know if you can "Automatically" open the right worksheet based on the result if you are putting the result in multiple cells, how would a macro know which cell you're wanting the use as reference?

The following change to your existing formula will create a Hyperlink to cell A1 (change this if required) in either the worksheet "Desktop" or "Notebook" depending upon the result. You will need to change the "Book1" reference to the name of your workbook.

Code:
=IF(VLOOKUP($J$2,Database!A:U,21,FALSE)=$X$2,HYPERLINK("[Book1] Desktop!A1","Desktop"),IF(VLOOKUP($J$2,Database!$A:$U,21,FALSE)=$X$5,HYPERLINK("[Book1] Notebook!A1","Notebook"),"Error!!!!!!!"))
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright ©2004-2018 OfficeFrustration.
The comments are property of their posters.