Results 1 to 3 of 3

Thread: List selected filenames in an Excel range of cells

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    14
    Rep Power
    0

    List selected filenames in an Excel range of cells

    Hi,

    How can I write the message in cell A2


    Code:
    Msg = "You selected:" & vbNewLine
    For I = LBound(FileNames) To UBound(FileNames)
    Msg = Msg & FileNames(I) & vbNewLine
    Next I
    MsgBox Msg
    [/code]

    I my VBA code I can select many files, and I need to write in some cells starting with A12

    Thank you.

  2. #2
    Member
    Join Date
    Nov 2011
    Posts
    41
    Rep Power
    0
    Hi Tomylee,

    Please use this i hope this will help you.
    Code:
    Public Sub GetBrandsFiles()
        Dim varArrFile  As Variant
        Dim intCtr      As Integer
        Dim strFiles    As String
        Dim rngFiles    As Range
        
        With ThisWorkbook.Worksheets("Sheet2")
            Set rng = .Range("A1")
            varArrFile = Application.GetOpenFilename("*.xls,*.xlsx", , "Select Brands Files", , True)
            If IsArray(varArrFile) = False Then
                MsgBox "Please Select Brand File..."
                shtIndex.Range("rngBrand1").Value = ""
                Exit Sub
            Else
                rng.Offset(0, 1).Value = "Following Files have selected by you :"
                For intCtr = LBound(varArrFile) To UBound(varArrFile)
                    rng.Offset(intCtr, 1).Value = varArrFile(intCtr)
                Next
            End If
        End With
    End Sub
    Regards
    Prince

  3. #3
    Junior Member
    Join Date
    Sep 2012
    Posts
    14
    Rep Power
    0
    Hi Prince,

    Thank you very much. It's all I need.
    Once again thank you.

Similar Threads

  1. Replies: 13
    Last Post: 06-10-2013, 09:05 AM
  2. Replies: 3
    Last Post: 05-14-2013, 03:25 PM
  3. Replies: 0
    Last Post: 02-27-2012, 01:07 AM
  4. Checking if range of cells=VbNullstring
    By Rasm in forum Excel Help
    Replies: 2
    Last Post: 02-03-2012, 07:24 AM
  5. Copy selected data to other excel sheet
    By dhiraj.ch185 in forum Excel Help
    Replies: 2
    Last Post: 02-02-2012, 06:23 AM

Posting Permissions

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