+ Reply to Thread
Results 1 to 5 of 5

VBA Clear Cell Contents

  1. #1
    Registered User
    Join Date
    08-16-2005
    Posts
    4

    VBA Clear Cell Contents

    I have written a simple Macro to clear a cell range, however it clears all the formats as well as the text.

    All I am after is the text deleting, but not eh cell formats, as some are in % and some currency, to drive later formulas.

    The code I have is

    Sub Clear_Form()
    Worksheets("selectordump").Range("a2:c2,b8:b12").Clear

    End Sub

    anyone know what I should do just to erase the text?

  2. #2
    Zack Barresse
    Guest

    Re: VBA Clear Cell Contents

    Yes, Clear will clear everything including formats. If you want just text,
    use ClearContents.

    --
    Regards,
    Zack Barresse, aka firefytr, (GT = TFS FF Zack)



    "towl" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have written a simple Macro to clear a cell range, however it clears
    > all the formats as well as the text.
    >
    > All I am after is the text deleting, but not eh cell formats, as some
    > are in % and some currency, to drive later formulas.
    >
    > The code I have is
    >
    > Sub Clear_Form()
    > Worksheets("selectordump").Range("a2:c2,b8:b12").Clear
    >
    > End Sub
    >
    > anyone know what I should do just to erase the text?
    >
    >
    > --
    > towl
    > ------------------------------------------------------------------------
    > towl's Profile:
    > http://www.excelforum.com/member.php...o&userid=26340
    > View this thread: http://www.excelforum.com/showthread...hreadid=477931
    >




  3. #3
    Jim Thomlinson
    Guest

    RE: VBA Clear Cell Contents

    Change Clear to ClearContents...
    --
    HTH...

    Jim Thomlinson


    "towl" wrote:

    >
    > I have written a simple Macro to clear a cell range, however it clears
    > all the formats as well as the text.
    >
    > All I am after is the text deleting, but not eh cell formats, as some
    > are in % and some currency, to drive later formulas.
    >
    > The code I have is
    >
    > Sub Clear_Form()
    > Worksheets("selectordump").Range("a2:c2,b8:b12").Clear
    >
    > End Sub
    >
    > anyone know what I should do just to erase the text?
    >
    >
    > --
    > towl
    > ------------------------------------------------------------------------
    > towl's Profile: http://www.excelforum.com/member.php...o&userid=26340
    > View this thread: http://www.excelforum.com/showthread...hreadid=477931
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: VBA Clear Cell Contents

    Use Clearcontents instead of Clear

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "towl" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have written a simple Macro to clear a cell range, however it clears
    > all the formats as well as the text.
    >
    > All I am after is the text deleting, but not eh cell formats, as some
    > are in % and some currency, to drive later formulas.
    >
    > The code I have is
    >
    > Sub Clear_Form()
    > Worksheets("selectordump").Range("a2:c2,b8:b12").Clear
    >
    > End Sub
    >
    > anyone know what I should do just to erase the text?
    >
    >
    > --
    > towl
    > ------------------------------------------------------------------------
    > towl's Profile:

    http://www.excelforum.com/member.php...o&userid=26340
    > View this thread: http://www.excelforum.com/showthread...hreadid=477931
    >




  5. #5
    Ron de Bruin
    Guest

    Re: VBA Clear Cell Contents

    Hi towl

    Use ClearContents instead of Clear

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "towl" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have written a simple Macro to clear a cell range, however it clears
    > all the formats as well as the text.
    >
    > All I am after is the text deleting, but not eh cell formats, as some
    > are in % and some currency, to drive later formulas.
    >
    > The code I have is
    >
    > Sub Clear_Form()
    > Worksheets("selectordump").Range("a2:c2,b8:b12").Clear
    >
    > End Sub
    >
    > anyone know what I should do just to erase the text?
    >
    >
    > --
    > towl
    > ------------------------------------------------------------------------
    > towl's Profile: http://www.excelforum.com/member.php...o&userid=26340
    > View this thread: http://www.excelforum.com/showthread...hreadid=477931
    >




+ 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