Solved

Basic question about Excel Visual Basic

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

929 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

11 Experts available now in Live!

Get 1:1 Help Now