How to disable Excel's automatic cell reference change after copy/paste?

后端 未结 13 2274
温柔的废话
温柔的废话 2020-12-07 23:14

I\'ve got a massive Excel 2003 spreadsheet I\'m working on. There are a lot of very large formulas with a lot of cell references. Here\'s a simple example.

=         


        
13条回答
  •  没有蜡笔的小新
    2020-12-07 23:42

    I found this solution which automates @Alistair Collins solution.

    Basically you will change the = in any formula to * then do the paste after that you will change it back

            Dim cell As Range
    
    msgResult = MsgBox("Yes to lock" & vbNewLine & "No unlock ", vbYesNoCancel + vbQuestion, "Forumula locker")
    
    If msgResult = vbNo Then
        For Each cell In Range("A1:i155")
            If InStr(1, cell.Value, "*") > 0 Then
                cell.Formula = Replace(cell.Formula, "*", "=")
            End If
        Next cell
    ElseIf msgResult = vbYes Then
        For Each cell In Range("A1:i155")
            If cell.HasFormula = True Then
                cell.Formula = Replace(cell.Formula, "=", "*")
            End If
        Next cell
    End If
    

提交回复
热议问题