NEED HELP URGENT!!!
Posted by Colin on November 16, 2001 8:00 AM
I need to develop a macro to put the sum formula into a cell in a worksheet the following code won't work because it throws an object or application-defined error:
Sub twelve()
ActiveCell.Select
r = Selection.Row
c = Selection.Column
Selection = "=SUM("
Worksheets("salaries").Activate
For counter = 10 To 850
If Cells(counter, 2) = "1200" Then
Worksheets("2001-2002").Cells(r, c) = Worksheets("2001-2002").Cells(r, c) + "salaries!L" + CStr(counter) + "+"
End If
Next
Worksheets("2001-2002").Activate
End Sub
All I need to knowis how this code needs to be changed in order to make the code work and print the sum function in the cell.
Thanks
Colin