ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro to repeat a formula a set number of rows apart (https://www.excelbanter.com/excel-discussion-misc-queries/98291-macro-repeat-formula-set-number-rows-apart.html)

steveo

macro to repeat a formula a set number of rows apart
 
Hi guys, does any body have a macro that would repeat a formula a set
number of rows apart (1200) in a column?There's multiple worksheets
grouped together in a workbook and it would be nice if it would repeat
in the same column same location in each. the start would be L25. The
formula is a countif that refers to data in the d column. Each
worksheet has a different end of data in the d column. Any help would
be greatly appreciated. You guys have been right on everything so far.
THANKS! steveo


mrice

macro to repeat a formula a set number of rows apart
 

Try this

Sub Macro1()
For Each Sheet In Sheets
For N = 25 To 65536 Step 1200
Sheet.Cells(N, 12).Formula = "=Countif(" & Cells(N, 4).Address
& ",100)"
Next N
Next Sheet
End Sub

In the example the formula counts if the Cell in col 4 in the same row
= 100. Just adapt this for your needs.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=559693



All times are GMT +1. The time now is 03:30 PM.

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