+ Reply to Thread
Results 1 to 3 of 3

Auto populate code - needs tweaking slightly

Hybrid View

  1. #1
    Registered User
    Join Date
    07-27-2015
    Location
    uk
    MS-Off Ver
    2013
    Posts
    6

    Auto populate code - needs tweaking slightly

    I have multiple worksheets that will be used to input data, and will have a Master Sheet which will automatically populate itself, consolidating the data from the multiple worksheets into the one master sheet.

    I have the code for this and it works, however the master sheet is updated in the sequential order that the worksheets are in.

    For example, I have MASTER SHEET, then SHEET ONE, SHEET TWO, SHEET THREE. When I update SHEET ONE and SHEET THREE they follow in order. But if I then update SHEET TWO it will move above SHEET THREE. I would like to make a subtle tweak to the code to just keep the order the master is updated based on time sequence, i.e when the worksheets are updated, and not the worksheet sequence.

    Does that make sense?


    Here is the code:

    Private Sub Worksheet_Activate()
    Dim Sheet As Worksheet
    For Each Sheet In Me.Parent.Sheets
        If Sheet.Name <> Me.Name Then
            If Sheet.Cells(Rows.Count, 1).End(xlUp).Row <> 1 Then
                Sheet.Range(Sheet.Cells(2, 1), Sheet.Cells(Sheet.Cells(Rows.Count, 1).End(xlUp).Row, 10)).Copy Destination:=Me.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
    
            End If
        Else
            Me.Range(Cells(2, 1), Cells(Rows.Count, 10)).Clear
        End If
    Next Sheet
    End Sub
    Last edited by riskreep; 02-01-2016 at 08:53 AM.

  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: Auto populate code - needs tweaking slightly

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

    Posting code between [CODE] [/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.

  3. #3
    Registered User
    Join Date
    07-27-2015
    Location
    uk
    MS-Off Ver
    2013
    Posts
    6

    Re: Auto populate code - needs tweaking slightly

    My apologies now rectified

+ 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. Easy date auto populate code needed
    By ExcelGuroo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2015, 03:47 PM
  2. How to use VBA Code to auto populate with condition in specific sheet
    By ray.kanata in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2015, 03:24 PM
  3. VBA Code to auto populate a fax template based critera's
    By sara101 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-14-2014, 10:56 AM
  4. Replies: 3
    Last Post: 02-28-2012, 11:54 AM
  5. Need code to compare and auto populate the next tab.
    By bharani in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2010, 11:23 AM
  6. VBA code to auto populate different cells
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2009, 12:15 PM
  7. Code to auto populate a relative formula into a column
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-13-2009, 12:30 PM

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