Results 1 to 6 of 6

How to create dynamic CopyToRange in Excel VBA?

Threaded View

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    How to create dynamic CopyToRange in Excel VBA?

    Hi

    Today my question is "Is it possible to create a dynamic CopyToRange in advance filter in VBA like I have two macros here

    Sub Macro1()
        Range("DG10:DQ10").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.ClearContents
        Range("DG10").Select
        Range("A7:K1048576").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
        Range("Journal!DH4:DH5"), CopyToRange:=Range("DG9:DQ9"), Unique:=False
        
    End Sub
    Here is the other one which I want to edite
    Sub Macro2()
    
        Range("A7:K1048576").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
            Range("DI4:DI5"), CopyToRange:=Range(some range), Unique:=False
        
    End Sub
    Now required is that the result of Macro2 should be pasted to the last empty row of the result of Macro1
    How can I change the line of code of Macro 2 (the bold line) to get the required results?

    Your help will be much appreciated as I am stuck with this situation.

    Best Regards
    Imran Bhatti
    Attached Files Attached Files
    Teach me Excel VBA

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel VBA Create Dynamic Userform
    By raw_geek in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-06-2015, 10:21 AM
  2. Advance Filter - define Dynamic CopyToRange below last row of existing data
    By pci1239 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-23-2015, 03:41 PM
  3. CopyToRange
    By laguna92651 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2015, 03:10 AM
  4. Create Macro for dynamic set of rows in excel
    By pavanexcel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-18-2014, 05:42 AM
  5. [SOLVED] Create a Dynamic Chart from an Excel Table
    By Elīna in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 07-29-2013, 12:45 PM
  6. create dynamic ddbox in excel with vb
    By john gault in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2006, 05:16 PM
  7. I want to be able to create a dynamic reference in excel, for exam
    By Lee in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-05-2006, 12:55 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