+ Reply to Thread
Results 1 to 2 of 2

removing values not links

  1. #1
    Jase
    Guest

    removing values not links

    Hi All

    I have a worksheet with around 5000 rows and 10 columns. Held within these
    values are formulas and values. I am trying to get some code that removes
    all of the values but does not touch the formula's.

    I have been able to do this with a big loop, but this takes soooo long it is
    ridiculous. I was wondering if anyone else has come up with a more efficent
    way of accomplishing this task.

    Thanks heaps
    Jase

  2. #2
    Norman Jones
    Guest

    Re: removing values not links

    Hi Jase,

    Try:

    Sub Tester04()
    Dim col As Range
    Dim Rng As Range
    Dim CalcMode As Long

    With Application
    CalcMode = .Calculation
    .ScreenUpdating = False
    .Calculation = xlCalculationManual
    End With

    ActiveSheet.UsedRange
    For Each col In ActiveSheet.UsedRange.Columns
    On Error Resume Next
    Set Rng = Intersect(col.SpecialCells(xlConstants), col)
    On Error GoTo 0
    If Not Rng Is Nothing Then Rng.ClearContents
    Next col

    With Application
    .ScreenUpdating = True
    .Calculation = CalcMode
    End With

    End Sub

    Each column is processed sequentially to avoid known (8192 areas) problems
    with large SpecialCells ranges.
    ---
    Regards,
    Norman



    "Jase" <[email protected]> wrote in message
    news:[email protected]...
    > Hi All
    >
    > I have a worksheet with around 5000 rows and 10 columns. Held within
    > these
    > values are formulas and values. I am trying to get some code that removes
    > all of the values but does not touch the formula's.
    >
    > I have been able to do this with a big loop, but this takes soooo long it
    > is
    > ridiculous. I was wondering if anyone else has come up with a more
    > efficent
    > way of accomplishing this task.
    >
    > Thanks heaps
    > Jase




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1