Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userforms / worksheets
i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook each button calls the same help system the help is built with a userform and a multi-page how do i detect which worksheet the help was launched from in order to set the mult-page to the correct page? ie if the user is on 'sheet 2' and they click the help button, the help will come up and display 'page 2' tia J |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
userforms / worksheets
ActiveSheet.name will give you the name of worksheet. I assume the HELP
button on the worksheet is attached to a macro which invokes the Help Userform so you will have name available to you. e.g. hlpSheet=Activeworksheet.Name HTH "Gixxer_J_97" wrote: i am writing a help system for my vba/excel project the help is launched from a button on each worksheet in the workbook each button calls the same help system the help is built with a userform and a multi-page how do i detect which worksheet the help was launched from in order to set the mult-page to the correct page? ie if the user is on 'sheet 2' and they click the help button, the help will come up and display 'page 2' tia J |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
userforms / worksheets
Test for ActiveSheet.Name, like so:
Select Case ActiveSheet.Name Case "Sheet1" 'calls up help for Sheet1 Case "Sheet2" 'calls up help for Sheet2 .. .. .. End Select "Gixxer_J_97" wrote: i am writing a help system for my vba/excel project the help is launched from a button on each worksheet in the workbook each button calls the same help system the help is built with a userform and a multi-page how do i detect which worksheet the help was launched from in order to set the mult-page to the correct page? ie if the user is on 'sheet 2' and they click the help button, the help will come up and display 'page 2' tia J |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
userforms / worksheets
Hi J
That depends. Is Sheet 2 the second sheet from the left ? If so Select Case ActiveSheet.Index Case 2 MsgBox "Yo" Case Else '... Ensure that users can't move, delete, insert sheets if so. If Sheet 2 is the sheet name then Select Case ActiveSheet.Name Case "Sheet 2" MsgBox "Yo" Case Else '... Ensure that users can't rename the sheets if so. Then you have code names (=name in the project explorer, like Sheet2). But maybe there's an even better identifier or way to do this ? HTH. Best wishes Harald "Gixxer_J_97" skrev i melding ... i am writing a help system for my vba/excel project the help is launched from a button on each worksheet in the workbook each button calls the same help system the help is built with a userform and a multi-page how do i detect which worksheet the help was launched from in order to set the mult-page to the correct page? ie if the user is on 'sheet 2' and they click the help button, the help will come up and display 'page 2' tia J |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
userforms / worksheets
thanks to all! some great ideas to work with!
i'ld like to keep it as dynamic as possible so if in the future i need to add another sheet (or move sheets around) i won't have to re-code everything. J "Harald Staff" wrote: Hi J That depends. Is Sheet 2 the second sheet from the left ? If so Select Case ActiveSheet.Index Case 2 MsgBox "Yo" Case Else '... Ensure that users can't move, delete, insert sheets if so. If Sheet 2 is the sheet name then Select Case ActiveSheet.Name Case "Sheet 2" MsgBox "Yo" Case Else '... Ensure that users can't rename the sheets if so. Then you have code names (=name in the project explorer, like Sheet2). But maybe there's an even better identifier or way to do this ? HTH. Best wishes Harald "Gixxer_J_97" skrev i melding ... i am writing a help system for my vba/excel project the help is launched from a button on each worksheet in the workbook each button calls the same help system the help is built with a userform and a multi-page how do i detect which worksheet the help was launched from in order to set the mult-page to the correct page? ie if the user is on 'sheet 2' and they click the help button, the help will come up and display 'page 2' tia J |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
userforms / worksheets
Hi,
You could try this code. Sub myHelp() mysheet = ActiveSheet.Name Select Case mysheet Case Is = "Sheet1" UserForm1.MultiPage1.Value = 0 UserForm1.Show Case Is = "Sheet2" UserForm1.MultiPage1.Value = 1 UserForm1.Show End Select End Sub Regards, Julian http://www.angelfire.com/biz7/julian...ans_macros.htm i am writing a help system for my vba/excel project the help is launched from a button on each worksheet in the workbook each button calls the same help system the help is built with a userform and a multi-page how do i detect which worksheet the help was launched from in order to set the mult-page to the correct page? ie if the user is on 'sheet 2' and they click the help button, the help will come up and display 'page 2' tia J |