+ Reply to Thread
Results 1 to 5 of 5

VBA cut from sheet 1 with multiple criteria onsheet 2,paste to next blank row sheet3

Hybrid View

  1. #1
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA cut from sheet 1 with multiple criteria onsheet 2,paste to next blank row she

    Hi,

    Why can't you simply use Data Filter Advanced (with a criteria range) to filter your data and then if you want to delete it use the SpecialCells(xlCellTypeVisible) syntax to delete the rows, or if copying just copy the filtered rows to the relevant sheet. This can be achieved with a couple of lines of code, e.g (untested)

    Range("MyRange").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("MyCopyLocation"), CriteriaRange:=Range("MyCriteria")
    Range("MyRange").CurrentRegion.Offset(1,0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  2. #2
    Registered User
    Join Date
    01-06-2012
    Location
    clearwater, Fl
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA cut from sheet 1 with multiple criteria onsheet 2,paste to next blank row she

    that sounds great...need to delete, but where would i put it?? and will it loop to get all the cells in the criteriarange? (a1:a)

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA cut from sheet 1 with multiple criteria onsheet 2,paste to next blank row she

    Hi,

    Where would you put what? You're deleting cells so presumably don't need to put them anywhere. If you're copying the rows somewhere then use a Copy and PasteSpecial syntax.

    You'll need to build a unique list of criteria values, then just wrap the code I gave you inside a For..Next loop which first moves down the list of values and copies each one to the relevant criteria cell.

    Regards

+ 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