+ Reply to Thread
Results 1 to 2 of 2

VBA to manipulate dates based on cell value

  1. #1
    Registered User
    Join Date
    12-20-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    1

    VBA to manipulate dates based on cell value

    Hi,

    I have data in columns A-C and rows 1-5 representing holiday dates e.g 1st line signifies an arrival at Site 1 on 4/6/14 for 7 nights. Ultimately I want to show a duration of 1 night against every date that is covered by the booking...I have attempted to illustrate this below.


    A B C
    1 Site Date Duration
    2 1 04/06/2014 7
    3 2 03/06/2014 4
    4 3 07/06/2014 1
    5 4 01/06/2014 2

    As stage 1, I have added VBA code that will add blank rows depending on the values in column C as follows:-

    A B C
    1 Site Date Duration
    2 1 04/06/2014 7
    3
    4
    5
    6
    7
    8
    9 2 03/06/2014 4
    10
    11
    12
    13 3 07/06/2014 1
    14 4 01/06/2014 2
    15

    Ultimately I want the data to appear as below and am looking for some vba help to achieve this!


    A B C
    1 Site Date Duration
    2 1 04/06/2014 1
    3 1 05/06/2014 1
    4 1 06/06/2014 1
    5 1 07/06/2014 1
    6 1 08/06/2014 1
    7 1 09/06/2014 1
    8 1 10/06/2014 1
    9 2 03/06/2014 1
    10 2 04/06/2014 1
    11 2 05/06/2014 1
    12 2 06/06/2014 1
    13 3 07/06/2014 1
    14 4 01/06/2014 1
    15 4 02/06/2014 1



    Many many thanks
    Graham

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA to manipulate dates based on cell value

    Here you go. This will insert rows for you. Run the code on you first 4 row example:

    Please Login or Register  to view this content.

+ 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. [SOLVED] how to manipulate dates/times
    By jmac1947 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-23-2014, 03:19 AM
  2. multiple string dates in cell, to array, and manipulate single elements
    By willara23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 07:48 PM
  3. How to manipulate cell index?
    By Gnimgnay in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-15-2011, 08:09 PM
  4. How to read a list and manipulate files based to it?
    By Gryzor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-19-2010, 07:54 AM
  5. Manipulate Cells Based on Selections
    By UHCChris in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-01-2009, 10:17 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