Writing Macro

T

Tammy Klein

I have never written a macro and need help with the code.
I need to take a set of data (1200 lines) and copy the
data for 26 weeks, incrementing the date by 7 days each
pass through. Any ideas as to what loop structure I
should use and what the code may look like?
 
B

Bob Phillips

Tazmmy,

Not clear where the date is, but let's assume in row 1, the code could be
something like

Dim i As Long, j As Long
For i = 2 To 26
Cells(1, i).Value = Cells(1, 1).Value + (i - 1) * 7
For j = 2 To 100
Cells(j, i).Value = Cells(j, 1).Value
Next j
Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top