LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default MsgBox containing text from cell

Try the the colde below. You need to put it into ThisWorkbook. First time
for me on here :)


Private Sub Workbook_Open()
'Run this program only if C29 is not null
If Worksheets("Instructions").Range("C29").Value < "" Then

' Get strDayOfWeek from the worksheet
Dim strDayOfWeek As String
strDayOfWeek = LCase(Trim(Worksheets("Instructions").Range("F29") .Value))

' Weekday function returns 1 for Sunday, 2 for Monday, 3 for Tuesday etc
' Set integer intDay accordingly
Dim intDay As Integer
If (strDayOfWeek = "sunday") Then
intDay = 1
End If
If (strDayOfWeek = "monday") Then
intDay = 2
End If
If (strDayOfWeek = "tuesday") Then
intDay = 3
End If
If (strDayOfWeek = "wednesday") Then
intDay = 4
End If
If (strDayOfWeek = "thursday") Then
intDay = 5
End If
If (strDayOfWeek = "friday") Then
intDay = 6
End If
If (strDayOfWeek = "saturday") Then
intDay = 7
End If

' Display message accordingly
If intDay = Weekday(Now()) Then
MsgBox "Reminder.... Project " & Cells("C29").Value & " due " &
strDayOfWeek
End If
End If
End Sub







"Nick Smith" wrote:

Folks,

Struggling with the MsgBox function.

I want a MsgBox to come up when it is the day a report is due. I have
defined the report title in one cell and the due day in another cell, eg
ThisWorkbook.Sheets("Instructions").Cell C29 contains "Status Report" and
ThisWorkbook.Sheets("Instructions").cell F29 contains "Wed". I want the
message to read "Reminder.... Project Status Report due today" with an OK
button to acknowledge when it is the day the report is due.
ThisWorkbook.Sheets("Instructions").Cell B1 contains the today() function to
define today's date.

However, if Cell C29 is empty, then no MsgBox should appear at all. That is
to say that the reminders are essentially user defined.

Was thinking along the lines of:

Private Sub ReminderMessageOnOpening()
If ThisWorkbook.Sheets("Instructions").Cells("C29") < "" Then
If ThisWorkbook.Sheets("Instructions").Cells("F29") =
ThisWorkbook.Sheets
("Instructions").B1 Then
MsgBox("Reminder.... Project" &C29 "due" today)
End If
End If
End Sub

Can anyone help please as I am struggling with this one.

Thanks in advance,

Nick

 
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
MsgBox text on several lines mohavv Excel Discussion (Misc queries) 1 November 21st 07 08:17 PM
How to center text in a msgbox Dave_2k5 Excel Discussion (Misc queries) 2 July 26th 05 01:20 PM
Centering MsgBox text Patrick Excel Programming 2 February 17th 05 07:49 PM
wrapping text in a pop-up box - MsgBox Abi Excel Programming 2 January 13th 05 01:37 PM
VBA MsgBox() Text gkelle[_9_] Excel Programming 2 April 20th 04 08:32 PM


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