Opv
01-25-2012, 08:50 AM
'CONVERT FORMULAS TO VALUES
Sub convFormulasToValues()
Dim lastRecRow As Integer
Dim formulaRng As Range
With Sheets("Checking")
On Error GoTo closeIt
lastRecRow = .Range("Rec").End(xlDown).Row
Set formulaRng = .Range("K4:K" & lastRecRow).SpecialCells(xlCellTypeFormulas)
If Right(lastRecRow, 2) = "00" And formulaRng.Count > 0 Then
Application.ScreenUpdating = False
formulaRng.Copy
formulaRng.PasteSpecial (xlPasteValues)
Application.ScreenUpdating = True
Application.CutCopyMode = False
Else:
GoTo closeIt
End If
End With
closeIt:
End Sub
This snipped is called from another script and is doing what it is suppose to do. It is called BEFORE a simple instruction to "Select" a designated cell at the bottom of the worksheet. It works fine so long as the prescribed conditions are not met. However, if the conditions are met, something in the above script is causing the formulaRng to remain selected so that the subsequent Select instruction is apparently being ignored. Does anything jump out as being the possible culprit?
Sub convFormulasToValues()
Dim lastRecRow As Integer
Dim formulaRng As Range
With Sheets("Checking")
On Error GoTo closeIt
lastRecRow = .Range("Rec").End(xlDown).Row
Set formulaRng = .Range("K4:K" & lastRecRow).SpecialCells(xlCellTypeFormulas)
If Right(lastRecRow, 2) = "00" And formulaRng.Count > 0 Then
Application.ScreenUpdating = False
formulaRng.Copy
formulaRng.PasteSpecial (xlPasteValues)
Application.ScreenUpdating = True
Application.CutCopyMode = False
Else:
GoTo closeIt
End If
End With
closeIt:
End Sub
This snipped is called from another script and is doing what it is suppose to do. It is called BEFORE a simple instruction to "Select" a designated cell at the bottom of the worksheet. It works fine so long as the prescribed conditions are not met. However, if the conditions are met, something in the above script is causing the formulaRng to remain selected so that the subsequent Select instruction is apparently being ignored. Does anything jump out as being the possible culprit?