Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello people,
I have a msgbox like this. MsgBox "Please click the command button on the sheet7", vbInformation, "Author" I require the VB code for the following: If the user presses the OK button of the msbox above, then the sheet7 must be shown on the screen. (like in VB6 (for example), form7.show) what would be the VBA code for that.. please help.. Thanks, Thulasiram |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ans = MsgBox( "Please click the command button on the sheet7", _
vbInformation + vbOKCancel, "Author") if ans = vbOk then Worksheets("Sheet7").Activate end if assuming Sheet7 is the tab name. If it is the code name then Sheet7.Activate -- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Hello people, I have a msgbox like this. MsgBox "Please click the command button on the sheet7", vbInformation, "Author" I require the VB code for the following: If the user presses the OK button of the msbox above, then the sheet7 must be shown on the screen. (like in VB6 (for example), form7.show) what would be the VBA code for that.. please help.. Thanks, Thulasiram |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Tom,
Thanks and nice to see your reply. -Thulasiram Tom Ogilvy wrote: ans = MsgBox( "Please click the command button on the sheet7", _ vbInformation + vbOKCancel, "Author") if ans = vbOk then Worksheets("Sheet7").Activate end if assuming Sheet7 is the tab name. If it is the code name then Sheet7.Activate -- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Hello people, I have a msgbox like this. MsgBox "Please click the command button on the sheet7", vbInformation, "Author" I require the VB code for the following: If the user presses the OK button of the msbox above, then the sheet7 must be shown on the screen. (like in VB6 (for example), form7.show) what would be the VBA code for that.. please help.. Thanks, Thulasiram |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Tom,
I am facing a compile error: Variable not defined.. Variable referred here is "ans" I tried ur code in a new excel file. It works. But, I am trying to embed the code in Private Sub Workbook_SheetSelectionChange(ByVal sh As Object, ByVal target As Range) So i have to declare the variable 'ans' So I gave a declaration dim ans as boolean but in this case: Runtime error '13': Type mismatch.. Please provide your help to fix this error. Thanks, Thulasiram Thulasiram wrote: Dear Tom, Thanks and nice to see your reply. -Thulasiram Tom Ogilvy wrote: ans = MsgBox( "Please click the command button on the sheet7", _ vbInformation + vbOKCancel, "Author") if ans = vbOk then Worksheets("Sheet7").Activate end if assuming Sheet7 is the tab name. If it is the code name then Sheet7.Activate -- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Hello people, I have a msgbox like this. MsgBox "Please click the command button on the sheet7", vbInformation, "Author" I require the VB code for the following: If the user presses the OK button of the msbox above, then the sheet7 must be shown on the screen. (like in VB6 (for example), form7.show) what would be the VBA code for that.. please help.. Thanks, Thulasiram |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim ans as Long
-- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Dear Tom, I am facing a compile error: Variable not defined.. Variable referred here is "ans" I tried ur code in a new excel file. It works. But, I am trying to embed the code in Private Sub Workbook_SheetSelectionChange(ByVal sh As Object, ByVal target As Range) So i have to declare the variable 'ans' So I gave a declaration dim ans as boolean but in this case: Runtime error '13': Type mismatch.. Please provide your help to fix this error. Thanks, Thulasiram Thulasiram wrote: Dear Tom, Thanks and nice to see your reply. -Thulasiram Tom Ogilvy wrote: ans = MsgBox( "Please click the command button on the sheet7", _ vbInformation + vbOKCancel, "Author") if ans = vbOk then Worksheets("Sheet7").Activate end if assuming Sheet7 is the tab name. If it is the code name then Sheet7.Activate -- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Hello people, I have a msgbox like this. MsgBox "Please click the command button on the sheet7", vbInformation, "Author" I require the VB code for the following: If the user presses the OK button of the msbox above, then the sheet7 must be shown on the screen. (like in VB6 (for example), form7.show) what would be the VBA code for that.. please help.. Thanks, Thulasiram |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom. Works perfectly
Tom Ogilvy wrote: dim ans as Long -- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Dear Tom, I am facing a compile error: Variable not defined.. Variable referred here is "ans" I tried ur code in a new excel file. It works. But, I am trying to embed the code in Private Sub Workbook_SheetSelectionChange(ByVal sh As Object, ByVal target As Range) So i have to declare the variable 'ans' So I gave a declaration dim ans as boolean but in this case: Runtime error '13': Type mismatch.. Please provide your help to fix this error. Thanks, Thulasiram Thulasiram wrote: Dear Tom, Thanks and nice to see your reply. -Thulasiram Tom Ogilvy wrote: ans = MsgBox( "Please click the command button on the sheet7", _ vbInformation + vbOKCancel, "Author") if ans = vbOk then Worksheets("Sheet7").Activate end if assuming Sheet7 is the tab name. If it is the code name then Sheet7.Activate -- Regards, Tom Ogilvy "Thulasiram" wrote in message ups.com... Hello people, I have a msgbox like this. MsgBox "Please click the command button on the sheet7", vbInformation, "Author" I require the VB code for the following: If the user presses the OK button of the msbox above, then the sheet7 must be shown on the screen. (like in VB6 (for example), form7.show) what would be the VBA code for that.. please help.. Thanks, Thulasiram |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Form keep the focus unable to get to the code - HELP! | New Users to Excel | |||
HELP!! Unhide Sheet with Macro and focus on other sheet | Excel Discussion (Misc queries) | |||
Code Only works when sheet is in focus | Excel Programming | |||
What is the VBA code to delete a sheet without warning message? | Excel Discussion (Misc queries) | |||
Code Repeats Itself And Goes To Wrong Focus | Excel Programming |