1

I have a cell with the format "mm/dd/yyyy hh:mm:ss". I want to auto increment the minute, but when I manually auto increment after selecting only that cell, it increments the day. To make it increment the minute, I have to manually copy the cell below, add one minute, select both and THEN increment. Is it possible to, in VBA, specify what part of the cell I want to be incremented when I use the

Selection.AutoFill 

function and only have one cell selected? As it is, recording the macro gives me

Selection.AutoFill Destination:=Range("BU2:BU3"), Type:=xlFillDefault
Community
  • 1
  • 1
Quintis555
  • 659
  • 3
  • 11
  • 16
  • 1
    No. [Range.AutoFill](http://msdn.microsoft.com/en-us/library/office/ff195345.aspx) only takes 2 parameters. To Autofill the way you want, you'll need to have at least 2 source cells to establish a pattern. – Daniel Oct 31 '12 at 19:48
  • It sounds like you've solved your own problem - selecting two cells allows Excel to determine the increment interval. – A. Webb Oct 31 '12 at 19:49
  • Doing everything I did by hand programmatically is possible, but I was hoping there was as simpler way of doing it. But thank you all! – Quintis555 Oct 31 '12 at 20:14

1 Answers1

2

In Excel dates and times are stored differently then in other languages.

From http://www.cpearson.com/excel/datetime.htm

Excel stores dates and times as a number representing the number of days since 1900-Jan-0, plus a fractional portion of a 24 hour day: ddddd.tttttt

This is called a serial date, or serial date-time.

If you want to increment by minute then you should add the fraction of a day that is equal to one minute

Minutes in a day = 1440

1 / 1440 = 0.00069444

Set your auto increment function to 0.00069444 and it should work they way you expect.

Community
  • 1
  • 1
losthorse
  • 1,530
  • 1
  • 13
  • 33