Thread: Query
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
MaC MaC is offline
external usenet poster
 
Posts: 4
Default Query

I assume you haven't tried my code, have you?

MaC

Użytkownik "JN" napisał w wiadomości
...
Actually, the worksheets are named Wksht1 & Wksht2. I was looking for a
user
prompt (similar to Access query user prompt) that would ask for the #s
found
in Col A and then, based on that information, open just that worksheet.
Example:

Before spreadsheet opens:
User prompt: (user types: 995346)

Wksht 2 would open.

Didn't know if I could do this in Excel or if I would have to use Access.



"Otto Moehrbach" wrote:

I take it that you have sheets named those numbers. I also take it that
you
want the user to select from the list in the sheet he is looking at.
There are several ways you can do this. One way is to setup a Data
Validation cell (also called a drop-down cell) in each sheet that
displays
the list on that sheet. It would be convenient if the cell address of
that
cell is the same in each sheet. For the following macro, I chose E1 as
that cell address. The user clicks the down-arrow on that cell and the
list
is displayed. The user scrolls the list until he finds the number he
wants
and clicks on that number.
The following macro will then fire by itself and the appropriate
sheet
is selected. This macro is a workbook macro and belongs in the workbook
module. To access that module, right-click on the Excel icon that is to
the
left of the "File" in the menu across the top of the screen, select View
Code, and paste this macro into the displayed module. Click on the "X"
at
the top right of the screen and you will be returned to your spreadsheet.
HTH Otto
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Count 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Target.Address(0, 0) = "E1" Then Sheets(CStr(Target.Value)).Select
End Sub
"JN" wrote in message
...
Is there any way to accomplish the following?

I have a workbook containing multiple worksheets. Col A in all
worksheets
contains a series of numbers that are unique:

Wksht 1 Wksht 2
Col A Col A
126345 995346
678910 798394

How can I get Excel to prompt the user for a # in Col A and, based on a
match, open JUST that worksheet.

Thanks for any/all help!