I am new to VBA. I have written this code inside a button click event in sheet called "Outputs".
The problem is when I try to copy data form TestInput sheet to Calculator sheet I get a run time error 1004.
My code is shown below
Do While currentInd < lastRows
With Worksheets("TestInput")
Worksheets("Calculator").Range(Cells(3, "C"), Cells(3, (lastColumns))).Value = .Range(.Cells(currentInd, "A"), .Cells(currentInd, lastColumns)).Value
End With
If I replace 3rd line of my code with Worksheets("Calculator").Range("C3:FC3").Value = .Range(.Cells(currentInd, "A"), .Cells(currentInd, lastColumns)).Value
then Its working fine but "lastColumns" is a variable which would change, so I dont want to fix my range to "C3:FC3"