Forum Discussion

Marc Wheeler's avatar
Marc Wheeler
Copper Contributor
Jul 24, 2018

VBA script - find a particular word - copy whole row to new sheet

Hi,

 

I need a VBA script that automatically searches for the word 'full' in column 'E' (from A to P) and then copies the entire row onto a new sheet. I want this to be a continuous process that I can do once a day

 

The original data is obtained automatically when the web query it refreshed.

 

Any thoughts?

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor
    Mr. Wheeler just in case you don't know how to use my test workbook... at the Top ribbon click DEVELOPER then the "Macro" at the left corner - Run the macros. or press ALT F8 and Run the macros... Sheet1 contains just a representation of a worksheet per your info where column E is where you find "Full" .. in case something 'went wrong' - just exit WITHOUT SAVING... HTH
    • Marc Wheeler's avatar
      Marc Wheeler
      Copper Contributor

      Thank you so much Lorenzo! It works perfectly.

       

      Excellent job sir.

      • Lorenzo Kim's avatar
        Lorenzo Kim
        Bronze Contributor

        Mr. Wheeler,

        I was looking at the codes recently and I discovered a glitch.

        There was an error in the Third turn copying - the attached file now is corrected and I made it a little bit more presentable.

        Based on the macros - you can copy anytime you wish then just delete all duplicates.

        Thank you..

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor

    Mr. Wheeler

    attached is a revised sample for you to test.  It can now delete duplicate range A-P.

    it may not be an MVP class work, but it delivers. If you find some errors - pls inform me.

    ** if ever I got hold of a better structured codes, I'll send it to you soonest.

     

    This is my way of paying it forward for the things that I have learned from this forum through the kind assistance of the many nice people here.

    Hope this helps

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor

    Mr. Wheeler

    attached pls find a revised sample for you to test.

    I incorporated in it the SUB to delete duplicates in "NewSheet" 

    you can change the name of the sheet in the VBE.

    in that routine you can continuously add records of E=Full to the newsheet -

    just delete any duplicates afterwards.

    Hope this helps..

    • Lorenzo Kim's avatar
      Lorenzo Kim
      Bronze Contributor

      Mr. Wheeler

      so sorry, there is an error in the Delete_Duplicate module!

      it only checks content of cell A not the entire range from A to P.

      I'll try to fix it.

      my apologies..

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor

    Mr. Wheeler

    Based on what I understand from your query, I made a sample where you can try.

    always make backup copies of your works.

    It is not the best structured code but it delivers !

    hopefully this is what you needed.

    otherwise, there are many good people here in the forum that can help you.. as they did me.

     

Resources