Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default ok cancel dialog box

Hi all,

I am trying to do a simple dialog box. I can't figure out how I can
do this. The user has to select appropriate cell ( by clicking into a
cell) in a work sheet to have the output of a macro go into that cell.
Now I wish to provide a dialog box that has ok and cancel. If the user
is ready for the output, he needs to click and select the appropriate
cell in the sheet and then click ok. If user wants to cancel, he can
click on cancel and the function will not run. I am trying to implement
this..Any ideas..thanks in advance...

shishi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ok cancel dialog box


Hello Shishi,

You may have a problem doing this. Both the MsgBox and InputBox use
modal dialogs. Once displayed you can not select anything on the
Worksheet. When is the MsgBox called and by what?

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=507811

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default ok cancel dialog box

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address(False, False) = "A1" Then
If MsgBox("Ready?", vbOKCancel) = vbOK Then MyMacroRunsHere
End If

End Sub


"shishi" wrote:

Hi all,

I am trying to do a simple dialog box. I can't figure out how I can
do this. The user has to select appropriate cell ( by clicking into a
cell) in a work sheet to have the output of a macro go into that cell.
Now I wish to provide a dialog box that has ok and cancel. If the user
is ready for the output, he needs to click and select the appropriate
cell in the sheet and then click ok. If user wants to cancel, he can
click on cancel and the function will not run. I am trying to implement
this..Any ideas..thanks in advance...

shishi


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default ok cancel dialog box

Sub Test()
Dim v As Object

On Error Resume Next
Set v = Application.InputBox(prompt:="Select a cell for output, or
cancel", Type:=8)
On Error GoTo 0

If Not v Is Nothing Then
MsgBox "User selected range " & v.Address
Else
MsgBox "User cancelled"
End If

End Sub

--
Tim Williams
Palo Alto, CA


"shishi" wrote in message
oups.com...
Hi all,

I am trying to do a simple dialog box. I can't figure out how I can
do this. The user has to select appropriate cell ( by clicking into a
cell) in a work sheet to have the output of a macro go into that cell.
Now I wish to provide a dialog box that has ok and cancel. If the user
is ready for the output, he needs to click and select the appropriate
cell in the sheet and then click ok. If user wants to cancel, he can
click on cancel and the function will not run. I am trying to implement
this..Any ideas..thanks in advance...

shishi



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default ok cancel dialog box

Here is the code snippet...

Sub DesignateStartingCell()
MsgBox "Select the starting cell for the first column"
Call GenerateNames("START_SPEC", "SPECS")

End Sub

The GenerateNames("START_SPEC", "SPECS"), is going to the generate a
NAMED RANGE at the selected cell. The name is START_SPEC and the sheet
name is SPECS.

May be I should use a msg like "Have you selected appropriate starting
Cell?" If the user clicks on YES, the code runs and if the user clicks
on NO the exit without calling GenerateNames("START_SPEC", "SPECS")...

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
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM
Bypassing OK/Cancel Dialog Box danchen[_2_] Excel Programming 0 November 10th 04 07:45 PM
Bypassing OK/Cancel Dialog Box danchen Excel Programming 1 November 10th 04 07:34 PM
Print Dialog Cancel Button Todd Huttenstine Excel Programming 1 June 3rd 04 04:52 PM
Dialog Box - User hits cancel CS[_2_] Excel Programming 4 November 14th 03 10:05 PM


All times are GMT +1. The time now is 03:40 PM.

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

About Us

"It's about Microsoft Excel"