Search : in
By :

Create Msg/Popup to notify in Excel VBA

Last answer on Feb 12, 2009 2:48:19 am GMT Siebel SME, on Feb 10, 2009 3:17:02 pm GMT 
 Report this message to moderators

Hello,

I need a Excel VB script to notify/popup a message when the number of the letter U on a calendar exceeds 6, 8, 12 etc. It will have to check the range of the calendar searching for the letter U and adding them and then providing an automatic popup when the number of U's are greater than 6 and etc. Thanks..

Configuration: Windows XP
Internet Explorer 6.0

Best answers for « Create Msg/Popup to notify in Excel VBA » in :
How to Create Msg/Popup to notifications in Excel VBA? Show How to Create Msg/Popup to notifications in Excel VBA? Issue Solution Note Issue I need a Excel VB script to notify/popup a message when the number of the letter U on a calendar exceeds 6, 8, 12 etc. It will have to check the range of...
Repainting a cell using excel VBA Show Repainting a cell using excel VBA Issue Solution Note Issue I am writing a code in excel VBA to generate a report.I am totally new to VBA.Here's my code Private Sub CommandButton1_Click() Dim a1 As Integer Dim d1 As Integer Dim...
Connect a database (MDB) to excel Show[VBA] Connecting a database (MDB) to excel Below is a tips of how to connect an Access database (MDB) in an application excel Add reference Microsoft DAO object librairy X.X In a general module (eg Module1) paste the code below...
Adding a VBA CommandButton with its respective the code ShowAdding a VBA CommandButton with its respective the code Paste these two sub in a general module (Module1 for example). Sub CreateButton() Dim Obj As Object Dim Code As String Sheets("Sheet1").Select 'create button ...
VBA: Finding Hdc in an Excel worksheet or UserForm ShowVBA: Finding Hdc in an Excel worksheet or UserForm Here are two small examples on how to find Hdc in a worksheet: By clicking on Sheet1 the UserForm is displayed. Put the pointer on UF, hold the left mouse button down and drag the...
Download Unit Converter for Excel ShowIt is not always necessary to use an expensive or sophisticated program or to convert measurement units. It is sometimes enough to use Excel worksheet by only adding a plug-in. Unit Converter for Excel is one of Microsoft Excel plug-in which can...

1

Helper, on Feb 11, 2009 1:32:22 am GMT
  • +4

You stated you wanted the msgbox to pop up automatically, so the code will have to go into the worksheet change event and not just a regular macro or command button. Here is the code but I also have a link for you to check the file out. I made a February 2009 calendar and just added random words with the letter "U" in them. The total is at six words. Type in a word or words that you would actually use, and see if that is what you need. Hope this helps.

[URL=http://www.4shared.com/file/87077596/56259f70/Calendar.html]Calendar.xls/URL


Private Sub Worksheet_Change(ByVal Target As Range)

Dim i As Variant
Dim letter
letter = LCase("u")
letter2 = UCase("U")
Dim count As Integer
Dim FindU As Range
Set FindU = Range("A4:G12")
Dim temp

For Each i In FindU

If InStr(i, letter) > 0 Or InStr(i, letter2) > 0 Then

count = count + 1

temp = count

End If

Next i

Select Case temp

Case Is > 12

MsgBox "The number of U's have exceeded 12." & " The total is " & temp

Case Is > 8

MsgBox "The number of U's have exceeded 8." & " The total is " & temp

Case Is > 6

MsgBox "The number of U's have exceeded 6." & " The total is " & temp


End Select


End Sub

Reply to Helper

2

Siebel SME, on Feb 11, 2009 2:24:04 pm GMT

2 Questions:

When I try to run the Macro/VB Script it does nothing but come up with the Macros prompt to create a macro name. What do I do?

Is it different if I want to find the word "Unscheduled" in the calendar?

Thanks so much for your help..

Reply to Siebel SME

3

Helper, on Feb 12, 2009 1:20:32 am GMT

1) Did you copy and paste the code in you own worksheet? Where did you put the code?

2) It will not matter if the word is uppercase or lower case. This part is very important. The IntStr() is used so the way it is coded it will find the first occurance of "U" and count the position in the word and stop. So, the word "Unscheduled" only counts one "U" because it stops the first time it sees the character. Do you need the total to be one or two for that word? If you need it to count two, then that will be trickier to code.

Reply to Helper

4

 Siebel SME, on Feb 12, 2009 2:48:19 am GMT

I figured it out Helper.. thank you so much.. never mind. I got what you meant. MY new greater question is here: http://en.kioskea.net/forum/affich 67595 excel vba for multiple worksheets

Reply to Siebel SME