VBA to insert formulas that will move each day

I have a sheet called Data that will get populated each day with the current days data from another workbook.

The data is put into column A on the sheet and from ‘N4’ I have a count formula.

My problem is each day the file is opened a new date is inserted.   I need VBA code that will insert formulas in Sheet 1 starting in Row 6 under the most recent date.

The formula is to collect the data from the data sheet for its respective Name as in column B in Sheet1.[ i.e. EUR ‘B8’ in sheet 1 needs to look at ‘N6’ in the sheet Data ] and so no matter what column I am working on it will always remain static.

22nd Oct the formula would go into U8, 23 Oct.  V8, 26th Oct.  W8

I have attached a file which I hope makes this clear.

Thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

No attach
JagwarmanAuthor Commented:
Hmm! obviously I need to pay more attention.

pls try

Sub ImportData()

theDate = Range("Menu!D2")
On Error Resume Next
findDate = Evaluate("Match(" & theDate * 1 & ",Sheet1!F4:AZ4)")
On Error GoTo 0
If IsError(findDate) Then
    MsgBox "Date not found"
    Exit Sub
End If
Sheets("Sheet1").Cells(6, findDate + 5).Resize(17, 1).Value = Sheets("Data").Range("N4:N20").Value
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JagwarmanAuthor Commented:
perfect many thanks Rgonzo
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.