Display Message with Macro in Spreadsheet

April 21, 2009 by vba excel
Filed under: Excel Spreadsheet, Excel Vba 
Sponsor

Excel Vba Display Message with Macro in Spreadsheet [Q]

I have to create microsoft excel spreadsheet with a range of cells with excel formula. I would like to create display of message in excel spreadsheet

” This cell contains excel formulas. Please do not type here”

when a user clicks on a range of cells with excel formula.

Excel Vba Display Message with Macro in Spreadsheet [A]

I think using excel worksheet protection is much easier and safer (excel macros setting can be disabled).

But if you want:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim FormulaCells As Range

Set FormulaCells = Nothing
On Error Resume Next
Application.EnableEvents = False
Set FormulaCells = Intersect(Target, _
Target.Cells.SpecialCells(xlCellTypeFormulas), _
Me.UsedRange)
Application.EnableEvents = True
On Error GoTo 0

If FormulaCells Is Nothing Then
‘ok
Else
MsgBox “Your selection contains formulas”
Application.EnableEvents = False
Application.Goto Me.Range(”a1″)
Application.EnableEvents = True
End If

End Sub

If you want to try, rightclick on the excel worksheet tab that should have this behavior. Select view code. Paste this into the newly opened code window. I went back to A1. You should change that to where you want them to be if they selected a range with at least one cell with a excel formula.

Then back to microsoft excel to test it out.

Ps. Lots of things get disabled when you run excel vba macros. Try the undo or redo
buttons.

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • Live
  • MisterWong
  • Propeller
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
  • Print this article!

Rate This Tips:

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...


Incoming excel search terms

excel macro display message,vba display message,macro in spreadsheet,vba display,excel display message,excel macro display,excel vba display message,display message in excel macro,excel macro display a message,excel macro error message,how to display message with time delay in excel,mss,display error message in vba excel,display macro in excel,display message macro,display message vba excel,excel display message in a formula,excel macro message,excel macro message box,excel macro not show error messages,macro display message,macro how to display a message on error,macro to display a range of cells in message box,msg excel,vba display error message,xcel spreadsheet macro error,,assign a macro to display a message,cell displays macro,code to copy worksheet and disable macro,conditional error message excel,copy worksheet messagebox vba,creating a loading message for excel macro,creating displays from excel spreadsheets,disable error messages excel,disable error msg excel workbook,disable error popups excel vba,disable excel macros message,display a macro in excel,display a message in a macro,display a message in excel formula,display a message in excel if a cell is true,display a message in excel worksheet,display a string as text in an excel macro,display an error message excel,display cell vba,display cells in macro in excel,display error macro,display error message excel,display error message in excel vba



Related Excel Tips

Comments

Have another excel answer or questions for this problem ?
Feel free to post it here..