Solved

Basic question about Excel Visual Basic

Posted on 2011-03-07
2
234 Views
Last Modified: 2012-05-11
I am in Excel and need a macro to evaluate a date that a user input into a cell that I've named "CarOne". If the date is not at least 910 days old, then I need a message box to appear which says "You have to wait until <X>" where <X> is a date 910 days after the date in CarOne.

Thanks!
0
Comment
Question by:carlosab
2 Comments
 
LVL 10

Accepted Solution

by:
Makrini earned 500 total points
ID: 35065922
If Range("Carone") + 910 > Now() Then
        MsgBox ("You have to wait until ") & Format(Range("Carone") + 910, "dd/mm/yyyy")
    End If

Open in new window

0
 
LVL 6

Expert Comment

by:Eric Zwiekhorst
ID: 35066796
dear carlosab,

If the macro should be executed automaticaly when entering the date in carone you can do two things,

A) put on your sheet a combo box where the carone date has to be put. Use the Private Sub ComboBox1_Change() to look for changes in the combo box.
B) use the Private Sub Worksheet_Change(ByVal Target As Range) to look for changes in your cell and then execute the macro.


If you need an example of both possibilitys just ask and I will send you a excel...

Kind regards

Eric
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now