+ Reply to Thread
Results 1 to 4 of 4

Delete cell content

  1. #1
    Chuck Neal
    Guest

    Delete cell content

    Hi,
    I need to incorporate some code into my series of macros. I need to be able
    to check the entire worksheet and if "TRAN" appears anywhere, I need to clear
    the contents of that cell. Only the word TRAN, if it says TRANSLATE or some
    other similar word, I need it to stay. Since it would be a part of the macro
    series, filtering won't work because the data changes daily and I need it
    fairly automated.

    Thanks in advance,
    Chuck

  2. #2
    Gary''s Student
    Guest

    RE: Delete cell content

    Call this:

    Sub gsnu()
    Dim r As Range
    For Each r In ActiveSheet.UsedRange
    If r.Value = "TRAN" Then r.Clear
    Next
    End Sub

    --
    Gary's Student


    "Chuck Neal" wrote:

    > Hi,
    > I need to incorporate some code into my series of macros. I need to be able
    > to check the entire worksheet and if "TRAN" appears anywhere, I need to clear
    > the contents of that cell. Only the word TRAN, if it says TRANSLATE or some
    > other similar word, I need it to stay. Since it would be a part of the macro
    > series, filtering won't work because the data changes daily and I need it
    > fairly automated.
    >
    > Thanks in advance,
    > Chuck


  3. #3
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    Sub ClearTran()
    Cells.Replace What:="TRAN", Replacement:="", LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    End Sub
    Google is your best friend!

  4. #4
    Chuck Neal
    Guest

    RE: Delete cell content

    That did it! Thanks so much!

    "Gary''s Student" wrote:

    > Call this:
    >
    > Sub gsnu()
    > Dim r As Range
    > For Each r In ActiveSheet.UsedRange
    > If r.Value = "TRAN" Then r.Clear
    > Next
    > End Sub
    >
    > --
    > Gary's Student
    >
    >
    > "Chuck Neal" wrote:
    >
    > > Hi,
    > > I need to incorporate some code into my series of macros. I need to be able
    > > to check the entire worksheet and if "TRAN" appears anywhere, I need to clear
    > > the contents of that cell. Only the word TRAN, if it says TRANSLATE or some
    > > other similar word, I need it to stay. Since it would be a part of the macro
    > > series, filtering won't work because the data changes daily and I need it
    > > fairly automated.
    > >
    > > Thanks in advance,
    > > Chuck


+ 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