stephicohu
New Member
- Joined
- Jan 27, 2023
- Messages
- 32
- Office Version
- 365
- Platform
- MacOS
This is me again, what I did was take out all the .select and .activate from my subroutine and the code is shown below:
I run the program and I get an error code 9 the subscript is out of range. The debug shows the values right so I must of screw up again. Can you guys help in this matter? should I use a string formula?
VBA Code:
Sub FillingColumnSum(ByVal SourceMonth As String, ByRef TargetMonth As String, ByVal FirstRow1 As Integer, _
ByVal SecondRow1 As Integer, ByVal FirstColumn As Integer, ByVal TargetColumn As Integer)
Sheets(SourceMonth).Range(Cells(FirstRow1, FirstColumn), Cells(SecondRow1, FirstColumn)).Copy Sheets(TargetMonth).Range(Cells(FirstRow1, TargetColumn), Cells(SecondRow1, TargetColumn))
ActiveSheet.Paste Link:=True
End Sub
I run the program and I get an error code 9 the subscript is out of range. The debug shows the values right so I must of screw up again. Can you guys help in this matter? should I use a string formula?
Last edited by a moderator: