+ Reply to Thread
Results 1 to 2 of 2

Copying and pasting a dynamic range

  1. #1
    Registered User
    Join Date
    05-27-2015
    Location
    KL
    MS-Off Ver
    2007
    Posts
    1

    Copying and pasting a dynamic range

    Hope you guys can help me out with this

    Background:
    I am trying to build an activity manager for my sales team. Each one of them will hold a standardize template in which then they will update their appointments and then saved into a general folder. I then want to consolidate my entire team's activities into one sheet so that I have the master view

    Where I am:
    I am able to write a script that opens all files, copies and pastes perfectly. However this is where the problem starts. I am unable to write a script that identifies the range to copy (row and column). Currently all I have is a static range

    Case in point: (this is a sample of what a sales person would fill in on the daily
    Sales.jpg
    With each passing day, the list will grow longer downwards

    And I want to consolidate all my files, so the consolidated view looks something like this
    Conso.jpg

    Can someone help me out with my script?

    It is as such

    -------------------------------------------------------------------

    Sub ActivityManager()
    Dim MyFile As String
    Dim erow
    Dim Filepath As String
    Filepath = "C:\Pipeline Manager\"
    MyFile = Dir(Filepath)

    Do While Len(MyFile) > 0
    If MyFile = "zConsolidation.xlsm" Then
    Exit Sub
    End If

    Workbooks.Open (Filepath & MyFile)
    Range("A2:G6").Copy
    ActiveWorkbook.Close

    erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 1), Cells(erow, 7))

    MyFile = Dir
    Loop

    -------------------------------------------------------------------

    I believe the only remaining parts are in the ones highlighted in red. Help please?

    Thank you

    Best regards
    Wengie
    Attached Images Attached Images

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Copying and pasting a dynamic range

    Welcome to the forum. Pls take some minutes to read forum rules, because:

    1)Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums. --Actually in three more forums!!!-

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    2)Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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. Copying and pasting Named (Dynamic) Ranges from one workbook to the other
    By Let in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 10:06 AM
  2. Copying and Copy and Pasting Formula with Dynamic number of rows
    By patelh9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2010, 11:33 PM
  3. copying and pasting a dynamic range
    By mashoutposse in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2010, 06:16 PM
  4. Copying + pasting special a dynamic range of cells through a macro
    By kostas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2007, 07:20 AM
  5. Dynamic copying & pasting of rows
    By Chris Bromley in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-08-2005, 12:06 PM

Tags for this Thread

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