PDA

View Full Version : Macro to copy formulas across a worksheet



Slicemahn
08-20-2009, 02:05 AM
Hello Everyone!

i am currently trying to write a macro that would copy across formulas in a worksheet. This worksheet is huge so manually copying and pasting the formulas is tedious.

So i am trying to take a block of formulas and copy them across and down my sheet but i am running into a problem with my month and year end sum totals..

Any suggestions on how I can tackle this would be appreciated.

Bob Phillips
08-20-2009, 03:53 AM
What code are you using, what problem is arising?

Slicemahn
08-20-2009, 04:17 AM
Hey xld!

Sorry, here's the code I am trying and it will work for some areas but will stop at row 55.

Sub GeterDone()
Dim CRow As Long
Dim ColumnNum As Integer
CRow = 12
ColumnNum = 5
Do While Len(Cells(CRow, 2)) > 0
If Cells(CRow, 2).Value = "Total" Then
Range("E" & CRow, "F" & CRow).Select

Application.CutCopyMode = False
Selection.Copy
ColumnNum = ColumnNum + 4
Cells(CRow, ColumnNum).Select
ActiveSheet.Paste
End If

If ColumnNum >= 197 Then ColumnNum = 5

CRow = CRow + 1
Loop


End Sub

Let me know your thoughts.