Hello,

I am trying to put together a simple tool to copy and paste exact formulas using vba input boxes. I often have to copy exact formulas from various ranges and this little tool, when set in my toolbar, will help a lot.

The main problem I'm having is that the "paste range" is offset based on where the "copy range" is located within a worksheet. Here is my code:

----------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub CopyCells()

Dim rngFirst As Range
Dim rngSecond As Range
Dim cell As Range

'Get copy range
On Error GoTo Cancelled
Set rngFirst = Application.InputBox("Please select area to copy", "Obtain Range Object", Type:=8)
Err.Clear
On Error GoTo 0

'Get paste range
On Error GoTo Cancelled
Set rngSecond = Application.InputBox("Please select area to paste", "Obtain Range Destination", Type:=8)
Err.Clear
On Error GoTo 0

'Set paste range using copy range
For Each cell In rngFirst
rngSecond(cell.Row, cell.Column).Formula = cell.Formula
Next cell

Cancelled:
End Sub
---------------------------------------------------------------------------------------------------------------------------

I believe the problem lies entirely within my loop. Any help you can provide would be greatly appreciated.

Thank you for your time!
Chris