Results 1 to 5 of 5

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #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.

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
  •