I\'m trying to copy and paste a few cells keeping the format and them ebing linked to a table.
Currently i have a table but i am referencing it from another sheet e.
Select the cells you want and run the following in VBA:
Public Sub TestMe()
Dim myCell As Range
For Each myCell In Selection
If myCell.HasFormula Then myCell.Formula = myCell.Formula & "+1"
Next myCell
End Sub
If you press it too many times, this is how to remove it the last +1
:
Public Sub UnTestMe()
Dim myCell As Range
For Each myCell In Selection
If myCell.HasFormula Then myCell.Formula = Left(myCell.Formula, _
Len(myCell.Formula) - 2)
Next myCell
End Sub
Concerning the comment of @SJR, if you want to change the reference address of the cell, this is one possible workaround:
Public Sub TestMe()
Dim myCell As Range
For Each myCell In Selection
If myCell.HasFormula Then myCell.Formula = Left(myCell.Formula, _
Len(myCell.Formula) - 1) & 2
Next myCell
End Sub
Simply change the &2
to the number you want to refer to.