ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message Box (https://www.excelbanter.com/excel-programming/327384-message-box.html)

A-DESIGN

Message Box
 
Hi,

Is it possible to write a VBA on excel that when I click over a specific
worksheet's tab a message box pop-up and give me a message?

Thanks in advance



Chip Pearson

Message Box
 
Put code like the following in the ThisWorkbook code module.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
MsgBox "Hello world"
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"A-Design" wrote in message
...
Hi,

Is it possible to write a VBA on excel that when I click over a
specific worksheet's tab a message box pop-up and give me a
message?

Thanks in advance




A-DESIGN

Message Box
 
Thank you so much,

Should I paste it to ThisWorkbook or just the sheet that I need to use the
code on?
The message box,is it possible that I can change the color of the box or
message?

Thanks again.

"Chip Pearson" wrote in message
...
Put code like the following in the ThisWorkbook code module.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
MsgBox "Hello world"
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"A-Design" wrote in message
...
Hi,

Is it possible to write a VBA on excel that when I click over a specific
worksheet's tab a message box pop-up and give me a message?

Thanks in advance






Chip Pearson

Message Box
 
Put the code in the ThisWorkbook code module. No, you can't
change the colors of a msgbox.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"A-Design" wrote in message
...
Thank you so much,

Should I paste it to ThisWorkbook or just the sheet that I need
to use the code on?
The message box,is it possible that I can change the color of
the box or message?

Thanks again.

"Chip Pearson" wrote in message
...
Put code like the following in the ThisWorkbook code module.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
MsgBox "Hello world"
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"A-Design" wrote in message
...
Hi,

Is it possible to write a VBA on excel that when I click over
a specific worksheet's tab a message box pop-up and give me a
message?

Thanks in advance









All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com