• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Convert formulas into values (not continuous range)

Jovica

New Member
I have two columns with cells linked to another workbook, I would like to convert those cells to values. Problem is that they are not connected (after every couple of rows there is a sum function which I would like to stay intact), so I can not use line .Value = ...Value in VBA.

Cells that needs to be converted to values are selected with macro that selects unlocked cells.

Code:
Sub SelectUnlockedCells()
    Dim WorkRange As Range
    Dim FoundCells As Range
    Dim Cell As Range
    Set WorkRange = ActiveSheet.UsedRange
    For Each Cell In WorkRange
        If Cell.Locked = False Then
            If FoundCells Is Nothing Then
                Set FoundCells = Cell
            Else
                Set FoundCells = Union(FoundCells, Cell)
            End If
        End If
    Next Cell
    If FoundCells Is Nothing Then
        MsgBox "All cells are locked."
    Else
        FoundCells.Select
    End If
End Sub

I could write manual macro for every few cells with Value/Value line, but I'm sure that there is an easier way.
 
Back
Top