Results 1 to 19 of 19

VBA - default contents of a cell based on numerical value of another

Threaded View

  1. #1
    Registered User
    Join Date
    05-25-2015
    Location
    london
    MS-Off Ver
    2007
    Posts
    54

    VBA - default contents of a cell based on numerical value of another

    Hi Guys,

    I'm pretty new to VBA and am trying to make something work...

    My code is below; it does not work.

    This is probably because the syntax is wrong, but hopefully you can see what I'm trying to do...

    I want the cell in column F to read "Cold" if the cell to the left of it (column E) has a date in it which is over 90 days old.

    If its under 90 days, then i want it to do nothing as there is a data validation drop down box.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Sheets("Sheet1")
    Dim lvalue As Date
    lvalue = Now
    If .Cells("E1").Value > lvalue - 90 Then
    Else
    If .Cells("E1").Value < lvalue - 90 Then .Cells("F1") = "COLD"
    End If
    End With
    End Sub
    Last edited by zbor; 07-11-2016 at 07:51 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Easy If problem
    By lky2k23 in forum Excel General
    Replies: 2
    Last Post: 10-28-2011, 06:41 AM
  2. Easy problem
    By bradyj2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2011, 02:34 PM
  3. Calculation problem - Easy one?
    By Andydayuk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2010, 01:19 AM
  4. easy vba problem
    By northernstar197 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2007, 03:49 PM
  5. Problem with Formulas - Probably an easy way around it!!! HELP
    By scottp in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2006, 02:12 AM
  6. easy (?) subtraction problem
    By Tim Marsh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-07-2006, 02:30 PM
  7. Easy IF/Else Problem
    By Paul987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2006, 10:45 AM
  8. easy problem for programmers
    By Freddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1