Follow-Up - VBA Help Still Neeeded - Please help

excel102

New Member
Joined
Jul 28, 2017
Messages
9
I am new to VBA and I had the following one set-up:


Private Sub Workbook_Open()
MsgBox "Notify Customer 90 days prior to deadline"
MsgBox "Notify Customer when travel has exceeded 75%"
End Sub


However, the notifications were popping every time I open the worksheet and that was not effective. So I asked for help with the following:
1. I would like to add a condition for it to open only 90 days prior to cell C3 (assuming cell C3 has a date).
2. Assuming cell F3 contains the funding amount, I would like for the notification to pop only when it has reached 75% of cell F3.

And after several exchanges with a fellow member, he or she suggested I used the following:

Private Sub Workbook_Open()
If Sheets(1).Range("C3").Value - Date <= 93 And _
Sheets(1).Range("C3").Value >= 90 Then
MsgBox "Notify Customer 90 days prio to Deadline"
End If
If 'it' / Sheets(1).Range("F3").Value >= .75 Then
MsgBox "Notify Customer when travel has exceeded 75%"
End If
End Sub

The logic behind 93 days was in case 90 days fell on a weekend but I can't get it to work. Instead, I am getting the following error:

Rum-time error '13':

Type mismatch

What exactly does this mean and how can I fix it for both notifications to pop?

Thank you.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
yky,

Thank you for your response. Perhaps I need to provide a better explanation.

On the worksheet, I have 2 columns, F3 and G3. I would like to the code to go to F3, calculate 75% of it, and if the value of G3 exceeds 75% of F3, send a notification when I open the worksheet.

F3 G3
[TABLE="width: 236"]
<tbody>[TR]
[TD]$50,000[/TD]
[TD]$35,000[/TD]
[/TR]
</tbody>[/TABLE]


Please help. Thank you.
 
Upvote 0
try
Code:
Private Sub Workbook_Open()

    With Sheets(1)
        If .Range("C3").Value - Date <= 93 And .Range("C3").Value >= 90 Then
            MsgBox "Notify Customer 90 days prio to Deadline"
        End If
        If .Range("G3").Value >= .Range("F3").Value * 0.75 Then
            MsgBox "Notify Customer when travel has exceeded 75%"
        End If
    End With
End Sub
 
Last edited:
Upvote 0
Fluff,

Thank you for your response. It appears the code is exactly what I need. However, I'm getting an error. Error reads:

Run-time error '13':

Type mismatch

When I click on Debug, it highlights:
If .Range("C3").Value - Date <= 93 And .Range("C3").Value >= 90 Then

I attempted to do a print screen but was unsuccessful.

NOTE: I moved cells F3 and G3 to N4 and O4 but adjusted code accordingly.

Code currently reads:
Private Sub Workbook_Open()

With Sheets(1)
If .Range("C3").Value - Date <= 93 And .Range("C3").Value >= 90 Then
MsgBox "Notify Customer 90 days prio to Deadline"
End If
If .Range("O4").Value >= .Range("N4").Value * 0.75 Then
MsgBox "Notify Customer when travel has exceeded 75%"
End If
End With
End Sub

Any suggestions to clear the error?
 
Upvote 0
What sheet is your data on?
Are you sure that the value in C3 is a date?
 
Upvote 0
Fluff,

Thank you so much for your help!
C3 needed to be fixed. Code is now working.

Again, THANK YOU!

Any suggestions on how I can get more savvy on this topic?
 
Upvote 0
Glad to help & thanks for the feedback
as for
Any suggestions on how I can get more savvy on this topic?
There are plenty of books & websites dedicated to VBA
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top