I have the following code that needs to be executed only a certain number of times. The number of times it needs to be executed is dependent upon the number of rows of data. For example if I have 30,000 rows of data, I need the code executed 30,000 times. If I have 20,000 rows of data, I need the code executed 20,000 times. How do I set a loop up to count the total number of rows and then do a loop that number of times with the following code. (I know my code probably isn't the most effecient way to do this but it is the only way I could think of doing it with so many formulas and not freezing up Excel). Thanks
Sub CopyPasteSpecialFormulas()
ActiveCell.Range("A1:H1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Range("A1:H1").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub
Bookmarks