+ Reply to Thread
Results 1 to 4 of 4

Find, select & delete/move on if not found

  1. #1
    Registered User
    Join Date
    05-06-2014
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Find, select & delete/move on if not found

    Hi all,

    This is my first post so if I have missed any rules/regulations then my apologies.

    I am trying to put together a macro for formatting Audit Trails downloaded from Qube. I've attached a sample to try and illustrate my point.

    Ideally I would like the macro to:
    • Check if the worksheet is an Audit Trail
    • Resize Date Column
    • Hide Columns B & F, Resize Column E
    • Change number format of Column H to include (,)
    • Remove Unnecessary Costheads (5020, 5040, 5000, 5010, 6000 & 6020)
    • Go to Service Charge Costhead

    I have managed to get a (somewhat) working macro for all but the second to last bullet point. This is what I have so far:


    Please Login or Register  to view this content.
    I would like the macro to search for the costhead (i.e. 5020 Tenant Debtors), select that section, delete and move on to the next costhead; go through all unneeded ones and come back to '2000 Service Charges Levied', as this sometimes needs to be deleted too.

    At one point I did get this to work, but have since lost it trying to refine it!

    As some audit trails do not have the unnecessary costheads, I would like the macro to move on if it cannot find the exact term. This is where I got stuck.

    I'm sure there must be an extremely simple remedy to this problem, but I have absolutely no knowledge of VBA prior to this - so I'm amazed I've got this far!

    Any help would be greatly appreciated.

    Thank you all very much
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Find, select & delete/move on if not found

    Try this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-06-2014
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Find, select & delete/move on if not found

    That works perfectly, thank you very much.

    What would I need to change this to,

    Dim ws As Worksheet: Set ws = Sheets("Sheet2") 'change this if needed

    to make it work for any selected worksheet? Sorry for the simple questions, I'm still learning.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Find, select & delete/move on if not found

    Please Login or Register  to view this content.
    If this solves your question please mark this thread and solved and if you were happy with my service feel free to add some reputation (the little star on the left side of the post)

+ 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. Using the FIND in VBA move contents in found rows.
    By SWMagic in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-14-2014, 11:07 AM
  2. If text is found, move it to another cell + delete that row.
    By nobodyNZ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 03:05 AM
  3. Find all AND Select all that is found
    By Ruandi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2013, 04:21 AM
  4. find name; search column; if date found-return 3 data pts; move to next row
    By cdl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2008, 10:43 AM
  5. Find text String and select cell address where it is found?
    By JCIrish in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-16-2006, 09:45 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