NOEd
Coastal
- May 14, 2003
- 7
It can be a nusiance to copy eqns from cell to cell so this sometimes helps:
'Changes a cell to read the same as the cell it's refering to
Sub ClearIndirectRef()
With Selection
FRow = .Row
RowCt = .Rows.Count
LRow = FRow + RowCt - 1
FCol = .Column
ColCt = .Columns.Count
LCol = FCol + ColCt - 1
End With
If RowCt > 3 Or ColCt > 3 Then
a = MsgBox("Are you sure?", 1, "More than 3 rows selected"
If a = vbCancel Then Exit Sub
End If
For r = FRow To LRow
For c = FCol To LCol
Cells(r, c).Activate
t1 = Cells(r, c).Formula
If Len(t1) > 1 Then
If left(t1, 1) = "=" Then
a = Mid(t1, 2)
If Len(a) > 1 Then
t2 = Range(a).Formula
Cells(r, c).Formula = t2
End If
End If
End If
Next
Next
End Sub
'Changes a cell to read the same as the cell it's refering to
Sub ClearIndirectRef()
With Selection
FRow = .Row
RowCt = .Rows.Count
LRow = FRow + RowCt - 1
FCol = .Column
ColCt = .Columns.Count
LCol = FCol + ColCt - 1
End With
If RowCt > 3 Or ColCt > 3 Then
a = MsgBox("Are you sure?", 1, "More than 3 rows selected"
If a = vbCancel Then Exit Sub
End If
For r = FRow To LRow
For c = FCol To LCol
Cells(r, c).Activate
t1 = Cells(r, c).Formula
If Len(t1) > 1 Then
If left(t1, 1) = "=" Then
a = Mid(t1, 2)
If Len(a) > 1 Then
t2 = Range(a).Formula
Cells(r, c).Formula = t2
End If
End If
End If
Next
Next
End Sub