Solved

Basic question about Excel Visual Basic

Posted on 2011-03-07
2
238 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

749 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