+ Reply to Thread
Results 1 to 1 of 1

Data Analysis: Compare initial date with final date by looking up the latest revision

  1. #1
    Registered User
    Join Date
    06-08-2015
    Location
    Ottawa, Canada
    MS-Off Ver
    2010
    Posts
    1

    Question Data Analysis: Compare initial date with final date by looking up the latest revision

    Hello everyone,

    I'm still learning VBA and currently am very limited with vlookups to what I need to do in my daily tasks.
    I'm reading through a VBA book but I simply can't understand how to put it all together.

    I'll explain what I'm trying to do and what I think I should used, but I need help in writing the code.

    I'm collecting data on suppliers who change their delivery dates constantly so I have columns labelled from G to AG as Rev 0 to Rev 26 where Rev 0 is the first date they gave me and then every time they change the date to a new date, I simply move to the next column to the right and add the new date. Therefore I keep and history of the dates while tracking every date change. Each row is a different deliverable with a long list(columns) of revised dates.

    I want excel to find the last active Rev # for each row and compare it to the date in Rev 0. The comparison should be a subtraction to find the difference between the two dates. Then I want this "difference" to be pasted in Column F.

    --------------------------
    My research so far:

    Need to find last active cell in the row
    Do Until IsEmpty(ActiveCell.Value)
    ActiveCell.Offset(1,0).Select
    Loop

    - This should find the last active cell and select it. I now need to save this value into something...
    - Then I need to select the date value in column G(Rev 0)
    - Then I need to send them both into a function to compute the difference between both.

    Then use a function to compute difference
    Function ComputeDifference(Rev0,RevX)
    Dim R0, RX As Integer
    Result = RX-R0
    End Function

    Then I need to paste the value of the difference in column F
    Range("F2").Activate
    Paste.Value?

    Now I need to move to the row below and repeat this process again....and again until the end of the sheet.

    Lastly, I need to color the positive value as RED and the negative values as Green, I believe an If/else statement could work?
    If Cell.value<0 Then
    ActiveCell.Interior.Color = vbRed
    If Cell.Value >0 Then
    ActiveCell.Interior.Color = vbGreen
    Else
    ActiveCell.Interior.Color = vbWhite

    Can anyone help me out?
    Last edited by White_Glint; 06-08-2015 at 02:36 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 04-08-2015, 10:10 PM
  2. [SOLVED] Data Validation: using date in as initial date in range
    By dmorl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-01-2015, 10:10 AM
  3. how to extract latest date to a paticular date from diffrent date list
    By rudraalok in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-09-2014, 05:18 AM
  4. Adding one TextBox with weeks to text box with date to give final Date
    By davidloops in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2013, 08:25 PM
  5. [SOLVED] Macro to update pivot item (date format) in pivot table to latest date from data source.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 03:18 AM

Tags for this Thread

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