+ Reply to Thread
Results 1 to 6 of 6

Macro for finding specific Word and Deleting it

Hybrid View

  1. #1
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Cool Macro for finding specific Word and Deleting it

    Hello,
    I have a excel file with more then 10 sheets..Some of the sheets contains this word in some random cells" #DIV/0! " I want a macro which can find it in every sheet except parent sheet and can remove it.
    Regards

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro for finding specific Word and Deleting it

    Maybe:

    Sub Haidar123aabbzz()
    Dim ws As Worksheet
    Dim rcell As Range
    For Each ws In ActiveWorkbook.Worksheets
    ws.Activate
    If ws.Name <> "Parent Sheet's Name Goes Here" Then
        For Each rcell In ws.UsedRange
            If rcell.Text = "#DIV/0!" Then rcell.Value = ""
        Next rcell
    End If
    Next ws
    End Sub

  3. #3
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Macro for finding specific Word and Deleting it

    Parent sheet name can be different in each excel file can u make it more general.

  4. #4
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Macro for finding specific Word and Deleting it

    I have modified it

    Sub Haidar123aabbzz()
    Dim ws As Worksheet
    Dim rcell As Range
    For Each ws In ActiveWorkbook.Worksheets
    ws.Activate
    If ws.Index <> 1 Then
        For Each rcell In ws.UsedRange
            If rcell.Text = "#DIV/0!" Then rcell.Value = ""
        Next rcell
    End If
    Next ws
    End Sub

    But it is very time consuming because it gives new empty value to it...May be if it is deleted it will be good..
    can u modify to delete it.

  5. #5
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Macro for finding specific Word and Deleting it

    Deleting was more time consuming so the last one I modify is best
    Sub Haidar123aabbzz()
    Dim ws As Worksheet
    Dim rcell As Range
    For Each ws In ActiveWorkbook.Worksheets
    ws.Activate
    If ws.Index <> 1 Then
        For Each rcell In ws.UsedRange
            If rcell.Text = "#DIV/0!" Then rcell.Value = ""
        Next rcell
    End If
    Next ws
    End Sub
    Thanks

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro for finding specific Word and Deleting it

    You're welcome. I didn't know what you meant by Parent worksheet? Now it's clearer you meant Sheet1 or the first sheet. I've never heard it refered to as the parent worksheet before? I'm glad you got your problem solved. Please mark this thread as solved in accordance with Forum Rule No. 9.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to change colour of cell based on finding a specific word in the cell
    By Shelby761 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2014, 09:46 AM
  2. Finding specific text in a column and deleting rows
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2013, 04:09 PM
  3. Finding and Deleting values in specific worksheets
    By dummyinexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2011, 10:09 PM
  4. Finding a word, then deleting every row above that?
    By drucey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2006, 12:45 PM
  5. Finding specific word in column
    By Phil #3 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2005, 04:06 AM

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