ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing Macro (https://www.excelbanter.com/excel-programming/278723-writing-macro.html)

Tammy Klein

Writing Macro
 
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?

Bob Phillips[_5_]

Writing Macro
 
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)

"Tammy Klein" wrote in message
...
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?





All times are GMT +1. The time now is 04:44 AM.

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