Results 1 to 3 of 3

Thread: VBA using date

  1. #1
    2 Star Lounger
    Join Date
    May 2015
    Posts
    104
    Thanks
    15
    Thanked 0 Times in 0 Posts

    VBA using date

    Hi guys,

    I am looking for some guidance with a bit of code that would work based on dates.
    In my sheet I currently have items being copied over with all kind of details including the sale date in column "L".

    The format is: "16/02/2016", "31/01/2016" etc...
    I want to create a vba code that would run every time there is change on sheet "Sold" and it would check to see if the previous items date is a different month. If so insert a new row, delete conditional formatting and set the background "Blue" from "B to L" on the inserted row. Finally enter month and year in "B" in the format of February 2016.

    Thanks for looking.
    Ferenc

  2. #2
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,162
    Thanks
    47
    Thanked 976 Times in 906 Posts
    Previous item being defined as?
    Insert a new row where?

    cheers, Paul

  3. #3
    2 Star Lounger
    Join Date
    May 2015
    Posts
    104
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Paul T View Post
    Previous item being defined as?
    Insert a new row where?

    cheers, Paul
    Code:
    Item Name 	             Ins.	Type	  Qty	Cost	Return	Profit	 Profit %   LID	   Buy Date	 Sell Date
    Tracker to Sabre Upg.		        Upgrade	   1	30.0	 51.3	 21.3	  71.1%	     1	  06/07/2015	31/01/2016
    Tracker to Super Hornet Upg.		Upgrade	   1	25.0	 42.6	 17.6	  70.5%	     20	  12/06/2015	01/02/2016
    In this scenario the VBA should recognize the "new" month and insert a row in between the 2 items, set its background blue, and enter the "month, year" into the first cell of the inserted row.
    The item Range is B to L.

    I hope this makes it easier to understand.
    Last edited by Ferenc Nagy; 2016-02-17 at 12:11.

Posting Permissions

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