ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   insert new row every day. (https://www.excelbanter.com/excel-programming/447565-insert-new-row-every-day.html)

kardifflad

insert new row every day.
 
Hello and thank you all in advance.

Is there a way to insert a new column into a spreadsheet every day and enter the new date in the first column, then move the rest down?

So for instance i have my heading in rows 1 and 2. then freeze panes and my date for each day in columns 3, 4, 5 and so on. What i want it to do is every day when i open it, it moves all the data down one row and start a new row at line 3 for that days data.
Is there a nifty bit of code that could do this please?

Auric__

insert new row every day.
 
kardifflad wrote:

Is there a way to insert a new column into a spreadsheet every day and
enter the new date in the first column, then move the rest down?

So for instance i have my heading in rows 1 and 2. then freeze panes and
my date for each day in columns 3, 4, 5 and so on. What i want it to do
is every day when i open it, it moves all the data down one row and
start a new row at line 3 for that days data.
Is there a nifty bit of code that could do this please?


You could do something like this:

Sub addTodayRow()
If Cells(3, 1).Value < Date Then
Rows("3:3").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(3, 1).Value = Date
End If
End Sub

Change "1" in "Cells(3, 1)" to point at the column containing the dates.

Alternately, you could put that in the workbook's Workbook_Open event so it
happens every time the workbook is opened.

--
Well, **** YOU MR. BEAR!!! You speak lies!!! LIIIIES!!!

kardifflad

thankyou. thats works perfectly


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com