Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Message prompt in VBA

Display your own Run Time Errors:

Sub MyMacro()
On Error Goto MyError
'Your code here

Exit sub
MyError:
MsgBox "An error has occured"
End Sub

For more info go to http://www.ozgrid.com/VBA/ExcelVBAErrors.htm

"ltong" wrote in message
m...
Hi all,

Frank, yes it is a msgbox and I got the VBA code from Geof

Thank you, Geof and it works.


By the way, I need another VBA code to prompt a message again " Sorry,
the selected sheet for deletion is not found, OK " ? and it ends the
VBA code instead of prompting VBA error .

Regards
Lenard



"Geof Wyght" wrote in message
...
Lenard,
I believe a workbook must have at least 1 worksheet. So
your sub could have something like:
If ThisWorkbook.Worksheets.Count 1 Then
'run your deletesheets sub
Else
MsgBox prompt:="This worrkbook must have at least 1 sheet."
End If

Geof.
-----Original Message-----
Hi,

Please assist me on how to write an excel VBA code to

prompt a message
" No sheet is to be delete, OK" instead of prompting a

VBA error
message when I accidentally run a DeleteSheet macro,

which had already
deleted all sheets in a workbook.

With this additional codes so that the DeleteSheet macro

can be run
more smoothly.


Thanks
Regards
Lenard
.



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
Prompt to Save Message Adam O Excel Discussion (Misc queries) 2 December 10th 08 08:22 PM
help with message prompt Monty New Users to Excel 1 September 9th 05 10:03 AM
Disable Message Prompt in VBA ltong Excel Programming 6 October 3rd 04 11:41 AM
Data Validation Prompt Message Frank Kabel Excel Programming 0 February 20th 04 03:09 PM
Deleting a Prompt Message LC[_2_] Excel Programming 2 July 18th 03 09:46 PM


All times are GMT +1. The time now is 10:09 PM.

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

About Us

"It's about Microsoft Excel"