+ Reply to Thread
Results 1 to 6 of 6

Check cell formula

  1. #1
    Souris
    Guest

    Check cell formula

    I wanted to clear all the cells which have formula on it.
    Are there any function to check this like "Isformula" in VBA?

    Any information is great appreciated,




  2. #2
    Jim Thomlinson
    Guest

    RE: Check cell formula

    Try something like this...

    Sheet1.Cells.SpecialCells(xlCellTypeFormulas).ClearContents

    which clears all of the formulas on sheet 1
    --
    HTH...

    Jim Thomlinson


    "Souris" wrote:

    > I wanted to clear all the cells which have formula on it.
    > Are there any function to check this like "Isformula" in VBA?
    >
    > Any information is great appreciated,
    >
    >
    >


  3. #3
    Souris
    Guest

    RE: Check cell formula

    Thanks for the informaiton,
    It works, but it fails if there is no formula on the spreadsheet.
    Should I check that does spreadsheet have formula before run the code?

    Thanks again,


    "Jim Thomlinson" wrote:

    > Try something like this...
    >
    > Sheet1.Cells.SpecialCells(xlCellTypeFormulas).ClearContents
    >
    > which clears all of the formulas on sheet 1
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Souris" wrote:
    >
    > > I wanted to clear all the cells which have formula on it.
    > > Are there any function to check this like "Isformula" in VBA?
    > >
    > > Any information is great appreciated,
    > >
    > >
    > >


  4. #4
    Norman Jones
    Guest

    Re: Check cell formula

    Hi Souris,

    Whenever using the specialCells method it is advisable to use a
    precautionary error handler.



    Dim SH As Worksheet
    Dim rng As Range

    Set SH = Sheets("Sheet1")

    On Error Resume Next
    Set rng = SH.Cells.SpecialCells(xlFormulas)
    On Error GoTo 0

    If Not rng Is Nothing Then rng.ClearContents


    ---
    Regards,
    Norman



    "Souris" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks for the informaiton,
    > It works, but it fails if there is no formula on the spreadsheet.
    > Should I check that does spreadsheet have formula before run the code?
    >
    > Thanks again,
    >
    >
    > "Jim Thomlinson" wrote:
    >
    >> Try something like this...
    >>
    >> Sheet1.Cells.SpecialCells(xlCellTypeFormulas).ClearContents
    >>
    >> which clears all of the formulas on sheet 1
    >> --
    >> HTH...
    >>
    >> Jim Thomlinson
    >>
    >>
    >> "Souris" wrote:
    >>
    >> > I wanted to clear all the cells which have formula on it.
    >> > Are there any function to check this like "Isformula" in VBA?
    >> >
    >> > Any information is great appreciated,
    >> >
    >> >
    >> >




  5. #5
    Souris
    Guest

    Re: Check cell formula

    Is it possible to clear all the format like color and font...etc

    Thanks millions,

    "Norman Jones" wrote:

    > Hi Souris,
    >
    > Whenever using the specialCells method it is advisable to use a
    > precautionary error handler.
    >
    >
    >
    > Dim SH As Worksheet
    > Dim rng As Range
    >
    > Set SH = Sheets("Sheet1")
    >
    > On Error Resume Next
    > Set rng = SH.Cells.SpecialCells(xlFormulas)
    > On Error GoTo 0
    >
    > If Not rng Is Nothing Then rng.ClearContents
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "Souris" <[email protected]> wrote in message
    > news:[email protected]...
    > > Thanks for the informaiton,
    > > It works, but it fails if there is no formula on the spreadsheet.
    > > Should I check that does spreadsheet have formula before run the code?
    > >
    > > Thanks again,
    > >
    > >
    > > "Jim Thomlinson" wrote:
    > >
    > >> Try something like this...
    > >>
    > >> Sheet1.Cells.SpecialCells(xlCellTypeFormulas).ClearContents
    > >>
    > >> which clears all of the formulas on sheet 1
    > >> --
    > >> HTH...
    > >>
    > >> Jim Thomlinson
    > >>
    > >>
    > >> "Souris" wrote:
    > >>
    > >> > I wanted to clear all the cells which have formula on it.
    > >> > Are there any function to check this like "Isformula" in VBA?
    > >> >
    > >> > Any information is great appreciated,
    > >> >
    > >> >
    > >> >

    >
    >
    >


  6. #6
    Norman Jones
    Guest

    Re: Check cell formula

    Hi Souris,

    > Is it possible to clear all the format like color and font...etc


    Dim SH As Worksheet
    Dim rng As Range

    Set SH = Sheets("Sheet1")

    On Error Resume Next
    Set rng = SH.Cells.SpecialCells(xlFormulas)
    On Error GoTo 0

    If Not rng Is Nothing Then rng.Clear


    ---
    Regards,
    Norman



    "Souris" <[email protected]> wrote in message
    news:[email protected]...
    > Is it possible to clear all the format like color and font...etc
    >
    > Thanks millions,
    >
    > "Norman Jones" wrote:
    >
    >> Hi Souris,
    >>
    >> Whenever using the specialCells method it is advisable to use a
    >> precautionary error handler.
    >>
    >>
    >>
    >> Dim SH As Worksheet
    >> Dim rng As Range
    >>
    >> Set SH = Sheets("Sheet1")
    >>
    >> On Error Resume Next
    >> Set rng = SH.Cells.SpecialCells(xlFormulas)
    >> On Error GoTo 0
    >>
    >> If Not rng Is Nothing Then rng.ClearContents
    >>
    >>
    >> ---
    >> Regards,
    >> Norman
    >>
    >>
    >>
    >> "Souris" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > Thanks for the informaiton,
    >> > It works, but it fails if there is no formula on the spreadsheet.
    >> > Should I check that does spreadsheet have formula before run the code?
    >> >
    >> > Thanks again,
    >> >
    >> >
    >> > "Jim Thomlinson" wrote:
    >> >
    >> >> Try something like this...
    >> >>
    >> >> Sheet1.Cells.SpecialCells(xlCellTypeFormulas).ClearContents
    >> >>
    >> >> which clears all of the formulas on sheet 1
    >> >> --
    >> >> HTH...
    >> >>
    >> >> Jim Thomlinson
    >> >>
    >> >>
    >> >> "Souris" wrote:
    >> >>
    >> >> > I wanted to clear all the cells which have formula on it.
    >> >> > Are there any function to check this like "Isformula" in VBA?
    >> >> >
    >> >> > Any information is great appreciated,
    >> >> >
    >> >> >
    >> >> >

    >>
    >>
    >>




+ 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