Results 1 to 5 of 5

Thread: Import data from another workbook reference to its sheet name,

  1. #1
    Member
    Join Date
    Apr 2014
    Posts
    45
    Rep Power
    0

    Import data from another workbook reference to its sheet name,

    I have a MainWB, on sheet2 L1 is the dropdown list to list names of sheetnames of any subWB that opened, how to get these sheet names in to the dropdown list when any subWB is opened? i have many subWBs with different sheet names.

    and then i would like when the sheetname is selected from the dropdown list, it will extract the last no. of rows data (eg. 500 rows) from that sheet to the MainWB Sheet1 A2 with reference to the last row "time"

    the data in the subWB is

    Date value value value value value time
    .....
    .....
    .....
    .....
    .....
    Apr/1/2014 2000 100 120 100 110 11:30
    Apr/2/2014 1000 120 130 110 110 11:40
    Apr/3/2014 2000 100 120 100 110 11:50
    Apr/4/2014 1200 120 130 110 110 12:00
    Apr/5/2014 1300 100 120 100 110 12:10
    Apr/6/2014 1400 120 130 110 110 12:20
    Apr/7/2014 1500 100 120 100 110 12:30
    Apr/8/2014 1800 120 130 110 110 12:40

    if any sheet that has more time than the average last time, will get the minimal time, thats to say all data extracted the last time must be the same, any sheet with time greater than the lesser one, the rows will not be copied. all the data extract from the above sheet last time should be April/8/2014 12:40, that is the common last date

    I hope i describe it clearly, thanks for any help
    Last edited by mrprofit; 04-18-2014 at 04:51 PM.

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    mrprofit, this looks more like a request for a project help, then just a specific help. I would suggest you opt to offer a little compensation to a developer who can take this up. Click here to post a query to Hire a Developer
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Member
    Join Date
    Apr 2014
    Posts
    45
    Rep Power
    0
    OK, thank you, i will just stick to the first question, how to get these sheet names in to the dropdown list when any subWB is opened? the rest i can try to work it out

    Code:
    Sub UpdateValidationList()
         
        Dim wsArray As Variant
        Dim sWsList As String
        Dim x As Integer
         
        wsArray = AllWorkSheets()
         
         'Separate array of worksheet names into a string separated by commas.
        sWsList = Join(wsArray, ",")
         
         'Add sWsList string to data validation for "A1"
        With Sheets(2).Range("L1").Validation
            .Delete
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
            xlBetween, Formula1:=sWsList
        End With
    End Sub
     
     
     '-----------------------------------------------------------------------------
     'Function to return an array of all worksheet names
     '-----------------------------------------------------------------------------
    Public Function AllWorkSheets() As Variant
        Dim wsArray() As Variant
        Dim x As Integer
         
        ReDim wsArray(Sheets.Count - 1)
         
        For x = 0 To Sheets.Count - 1
            wsArray(x) = Sheets(x + 1).Name
        Next x
         
        AllWorkSheets = wsArray
         
    End Function
    how to modify this code so it can get opened subWB sheet names
    Last edited by mrprofit; 04-18-2014 at 10:56 PM.

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    55
    Rep Power
    13
    This is crosspost...

    Create Drop Down List for new opened sub worksheet Tabs

    where you received the response but did not condescend to answer ....
    Last edited by Ingolf; 04-19-2014 at 01:08 PM.

  5. #5
    Member
    Join Date
    Apr 2014
    Posts
    45
    Rep Power
    0
    saw it, thank you

Similar Threads

  1. Replies: 2
    Last Post: 09-30-2013, 03:40 PM
  2. Import Export Spreadsheet Macro Action Specific Sheet
    By Portucale in forum Access Help
    Replies: 3
    Last Post: 08-06-2013, 07:42 AM
  3. Replies: 6
    Last Post: 05-20-2013, 10:06 PM
  4. Replies: 1
    Last Post: 05-09-2013, 08:56 AM
  5. Replies: 7
    Last Post: 05-08-2013, 07:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •