Results 1 to 2 of 2

Thread: Help with a VBA code

  1. #1

    Help with a VBA code



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello,
    I have a dual process to do on a spreadsheet. I would like to put a date in one column (lets call it cell A1) which would in return put another date in a separate column but it would be dated 30 days ahead (let's call this cell A3).
    Then, then I put a date in a totally different column (cell A2), it would clear the cell that has the 30 day future date (Cell A3).
    I want to be able to do this in several rows, approx 200. What formula in VB would I use for all of this?
    HELP!!!!

  2. #2
    Conjurer Roger Govier's Avatar
    Join Date
    Mar 2011
    Location
    Located near Abergavenny, South Wales, UK
    Posts
    113
    Articles
    0
    Hi

    You are confusing your terminology.
    A Column, is a whole range of cells. Columns have letters, A, B, C etc. A whole column Range would be
    A1:A1048576

    A Row is a range of cells. Rows have number 1, 2, 3 etc. A whole row range would be
    A1:XFD1

    A cell is just one cell at the intersection of a Row and column e.g A2, B6, C10 etc.

    Anyway, If I have understood your request correctly, then hopefully the following does what you want.

    In Cell A1 I have entered the text Invoice Date, in A2 the text Actual Pay Date, and in cell Ae the text Expected Pay date

    In cell B3 I have the formula
    =IF(B$1="","",IF(B$2="",B$1+30,""))
    which I have copied through till Cell N3

    What this basically says is,
    If there is nothing in B1, then put nothing in B3
    If there is a date in B1, and there is nothing in B2, then put a date 30 days after the date in B1 in cell B3
    If there is a date in B1, and there is a Date in B2, then put nothing in cell B3

    I hope that this what you want.
    If not, then post back with a clearer description of your requirements
    Regards

    Roger Govier
    Microsoft Excel MVP
    http://www.technology4u.co.uk

Tags for this Thread

Posting Permissions

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