Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Warning pop up window

I have programmed a "clear worksheet" button on my page and I'd like to have
a warning window pop up to warn if the user wants to do this.

Private Sub ClearPage_Click()
Range ("A4:B6").Select
Selection.ClearContents
End Sub

Thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Warning pop up window

Hi,

Try this

Private Sub ClearPage_Click()
response = MsgBox("Are you sure you want to clear cells?", vbOKCancel)
If response < vbOK Then Exit Sub
Range("A4:B6").ClearContents
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"JeffK" wrote:

I have programmed a "clear worksheet" button on my page and I'd like to have
a warning window pop up to warn if the user wants to do this.

Private Sub ClearPage_Click()
Range ("A4:B6").Select
Selection.ClearContents
End Sub

Thanks for your help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Warning pop up window

Try

Sub ClearPage_Click()
If MsgBox("Are You Sure?",vbYesNo) = vbNo Then
Exit Sub
End If
' code to clear the sheet
End Sub

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]


On Mon, 15 Feb 2010 10:31:02 -0800, JeffK
wrote:

I have programmed a "clear worksheet" button on my page and I'd like to have
a warning window pop up to warn if the user wants to do this.

Private Sub ClearPage_Click()
Range ("A4:B6").Select
Selection.ClearContents
End Sub

Thanks for your help

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Warning pop up window

Worked like a charm! Thanks Mike

"Mike H" wrote:

Hi,

Try this

Private Sub ClearPage_Click()
response = MsgBox("Are you sure you want to clear cells?", vbOKCancel)
If response < vbOK Then Exit Sub
Range("A4:B6").ClearContents
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"JeffK" wrote:

I have programmed a "clear worksheet" button on my page and I'd like to have
a warning window pop up to warn if the user wants to do this.

Private Sub ClearPage_Click()
Range ("A4:B6").Select
Selection.ClearContents
End Sub

Thanks for your help

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Warning pop up window

Thanks Chip, your's work great as well. Much appreciated.

"Chip Pearson" wrote:

Try

Sub ClearPage_Click()
If MsgBox("Are You Sure?",vbYesNo) = vbNo Then
Exit Sub
End If
' code to clear the sheet
End Sub

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]


On Mon, 15 Feb 2010 10:31:02 -0800, JeffK
wrote:

I have programmed a "clear worksheet" button on my page and I'd like to have
a warning window pop up to warn if the user wants to do this.

Private Sub ClearPage_Click()
Range ("A4:B6").Select
Selection.ClearContents
End Sub

Thanks for your help

.

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
macro warning window Bodyshopman Excel Discussion (Misc queries) 4 October 7th 08 10:46 PM
Creating a warning window PCStechnical Excel Programming 11 October 5th 06 01:53 PM
Creating a warning window PCStechnical Excel Discussion (Misc queries) 6 October 4th 06 06:43 PM
Creating a Warning window PCStechnical Excel Worksheet Functions 2 October 4th 06 06:29 PM
Getting rid of macro warning window jayceejay Excel Programming 3 June 21st 04 08:38 AM


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