Link to home
Start Free TrialLog in
Avatar of Jagwarman
Jagwarman

asked on

Insert data to the right of last days data

Could an expert help me out with this one please

I have attached a file that has sheet 1 and sheet 2. Think of sheet 1 as the starting point and sheet 2 after the code has bee run.

Each day the report is run and each day I need to add a new column to the right of the last day working days data. So on sheet 1 you will see there are 3 days 1/4, 2/4 and 3/4

So today I need VBA code that will insert today to the right of 3/4 and include all of the conditional formats that are in the cells.  I also need there to be 3 blank columns between the last day and the column headed 'Type'

Sheet 2 is what I need it to look like after the Macro has run.

I hope that explains it clearly.

Thanks in advance
Insert.xlsx
Avatar of Jagwarman
Jagwarman

ASKER

An add on to the above info is:

1) I have uploaded a new file because the dates in the original could cause confusion so I have changed to dates in May as they originally showed April.

2) The file will be used for the entire month so when we move into a new month the first working day of the new month needs to start in column J and all other dates from previous month needs to be cleared.

Many thanks
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
robertbaron

I get Run-time error '1004' : Method 'Range' of object'_Global' failed at this line of code with your macro

Range("month_today").EntireColumn.Select

is that because I have to put month_start and month_today inspecific cells?
yes.  look at my example sheet.

name J3 as month_start.
name the last cell (eg K3/L3) as month_today.

they get reassigned as necessary by the macro,
both excellent thank you