+ Reply to Thread
Results 1 to 6 of 6

Need a macro to delete rows with specific word

  1. #1
    Registered User
    Join Date
    05-20-2012
    Location
    OMAN
    MS-Off Ver
    Excel 2019
    Posts
    80

    Need a macro to delete rows with specific word

    Hi Friend I am attaching a file and in that file I would like to delete all the rows with value "inventories"..Please help me...

    TRANSFER REG FOR DECEMBER 2012.xlsx

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need a macro to delete rows with specific word

    In which column does the word reside?

    I checked your file and found the word Inventories in column K. However, if you delete every row that contains that word in column K, you wont be left with any data.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-20-2012
    Location
    OMAN
    MS-Off Ver
    Excel 2019
    Posts
    80

    Re: Need a macro to delete rows with specific word

    Hi Arlu actually the word"inventories" is in column "J" and when I delete the rows with that word then we are left with the below details

    To Cost Centre: General - Ghala
    From Cost Centre: General - Salalah



    From Cost Centre: J02L-12 ELECTRICAL WORKS-CORNISH MUTTRAH - AL HABIB BUILDING

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need a macro to delete rows with specific word

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

  5. #5
    Registered User
    Join Date
    05-20-2012
    Location
    OMAN
    MS-Off Ver
    Excel 2019
    Posts
    80

    Re: Need a macro to delete rows with specific word

    Thanks a lot Arlette..it did solve my issue...

  6. #6
    Registered User
    Join Date
    01-07-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Need a macro to delete rows with specific word

    Hi Arlu thats a really useful Macro it works great, but is there any way to speed it up? Im using it to read about 1500 rows.

    Im new to VBA but essentially can =lrow (see below) be set to a row number to speed things up?

    For i = lrow To 4 Step -1

+ 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