Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Dialogue Box

Hi

When you merge cells MS Excel warns you and asks for your permissoin to
continue. I like to have a similar facility when running a macro. I would
like the box to ask me for a yes/no or a value?

Could someone help me with VBA codes for doing that please?

Thanks
Varne M
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Dialogue Box

Hi M,

Try something like:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to continue", _
Buttons:=vbYesNo, _
Title:="Continue?")

If res = vbNo Then
Exit Sub
End If

'your code

End Sub
'<<=============


---
Regards,
Norman


"Varne" wrote in message
...
Hi

When you merge cells MS Excel warns you and asks for your permissoin to
continue. I like to have a similar facility when running a macro. I would
like the box to ask me for a yes/no or a value?

Could someone help me with VBA codes for doing that please?

Thanks
Varne M



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Dialogue Box

Hi Norman

Thanks.

I am a little slow to VB so please explain somthing.

My codes are

Sub Deleter

Range("a1").select
Selection.ClearContents

End Sub

Now Norman How I annex my codes with yours? If I start at where you mention
my computer does not pick up the Macro?

Please reply.

Regards

M Varnendra


"Norman Jones" wrote:


Hi M,

Try something like:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to continue", _
Buttons:=vbYesNo, _
Title:="Continue?")

If res = vbNo Then
Exit Sub
End If

'your code

End Sub
'<<=============


---
Regards,
Norman


"Varne" wrote in message
...
Hi

When you merge cells MS Excel warns you and asks for your permissoin to
continue. I like to have a similar facility when running a macro. I would
like the box to ask me for a yes/no or a value?

Could someone help me with VBA codes for doing that please?

Thanks
Varne M




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Dialogue Box

Hi M,

Try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to continue", _
Buttons:=vbYesNo, _
Title:="Continue")

If res = vbNo Then
Exit Sub
End If
ActiveSheet.Range("A1").ClearContents

End Sub
'<<=============



---
Regards,
Norman


"Varne" wrote in message
...
Hi Norman

Thanks.

I am a little slow to VB so please explain somthing.

My codes are

Sub Deleter

Range("a1").select
Selection.ClearContents

End Sub

Now Norman How I annex my codes with yours? If I start at where you
mention
my computer does not pick up the Macro?

Please reply.

Regards

M Varnendra



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Dialogue Box

Hi Norman

Regardless of yes or no "a1" is deleted. Please check. Thanks.

Varne M

"Norman Jones" wrote:

Hi M,

Try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to continue", _
Buttons:=vbYesNo, _
Title:="Continue")

If res = vbNo Then
Exit Sub
End If
ActiveSheet.Range("A1").ClearContents

End Sub
'<<=============



---
Regards,
Norman


"Varne" wrote in message
...
Hi Norman

Thanks.

I am a little slow to VB so please explain somthing.

My codes are

Sub Deleter

Range("a1").select
Selection.ClearContents

End Sub

Now Norman How I annex my codes with yours? If I start at where you
mention
my computer does not pick up the Macro?

Please reply.

Regards

M Varnendra






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Dialogue Box

Hi N,

Regardless of yes or no "a1" is deleted. Please check. Thanks.


That is not my experience.

If the user selects the 'No' option, the Exit Sub instruction
prevents the processing of subsequent instructions.


---
Regards,
Norman


"Varne" wrote in message
...
Hi Norman

Regardless of yes or no "a1" is deleted. Please check. Thanks.

Varne M

"Norman Jones" wrote:

Hi M,

Try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to continue", _
Buttons:=vbYesNo, _
Title:="Continue")

If res = vbNo Then
Exit Sub
End If
ActiveSheet.Range("A1").ClearContents

End Sub
'<<=============



---
Regards,
Norman



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Dialogue Box

Sorry Norman

Your codes work. Thanks.

Best Regards

Varne M

"Norman Jones" wrote:

Hi N,

Regardless of yes or no "a1" is deleted. Please check. Thanks.


That is not my experience.

If the user selects the 'No' option, the Exit Sub instruction
prevents the processing of subsequent instructions.


---
Regards,
Norman


"Varne" wrote in message
...
Hi Norman

Regardless of yes or no "a1" is deleted. Please check. Thanks.

Varne M

"Norman Jones" wrote:

Hi M,

Try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to continue", _
Buttons:=vbYesNo, _
Title:="Continue")

If res = vbNo Then
Exit Sub
End If
ActiveSheet.Range("A1").ClearContents

End Sub
'<<=============



---
Regards,
Norman




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
Dialogue Box Flat disgusted Excel Discussion (Misc queries) 2 May 20th 08 06:46 PM
dialogue pop up Micayla Bergen Excel Discussion (Misc queries) 5 June 23rd 06 10:45 PM
pop up dialogue box Micayla Bergen New Users to Excel 1 June 23rd 06 02:34 AM
pop up dialogue Micayla Bergen Excel Discussion (Misc queries) 0 June 23rd 06 02:22 AM
Dialogue Box Ed Excel Programming 0 February 10th 04 06:30 PM


All times are GMT +1. The time now is 01:31 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"