Results 1 to 6 of 6

How to write values found via function into cell?

Threaded View

  1. #1
    Registered User
    Join Date
    08-30-2013
    Location
    Moscow, Russia
    MS-Off Ver
    Excel 2007
    Posts
    4

    How to write values found via function into cell?

    Hi all, I have a VBA function that pops up a folder dialog where the user selects a folder. Now I need that folder name (full path) to be written into a certain cell, but the code I've created for that doesn't work. Hope someone could help me out!

    Below are the function and the code. The code is supposed to pop up the browse dialog only if the existing cell value doesn't return a correct folder.

    Function BrowseFolder(Title As String, _
            Optional InitialFolder As String = vbNullString, _
            Optional InitialView As Office.MsoFileDialogView = _
                msoFileDialogViewList) As String
        Dim V As Variant
        With Application.FileDialog(msoFileDialogFolderPicker)
            .Title = Title
            .Show
        End With
        BrowseFolder = CStr(V)
    End Function



    Sub Folder_Picker()
    
    Dim FolderPath As String
    
    FolderPath = Worksheets("Abc").Cells(3, 7).Value & "\"
    
    If Dir(FolderPath & "*.xlsx") = "" Then
    Sheets("Abc").Select
    Cells(3, 7).Value = BrowseFolder("Please select the folder")
    End If
    
    End Sub
    Last edited by IOwnAKangaroo; 11-07-2013 at 08:58 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 04-25-2013, 02:06 PM
  2. [SOLVED] RE-write if function with isna function for more values
    By funtastic in forum Excel General
    Replies: 6
    Last Post: 07-12-2012, 04:33 AM
  3. Replies: 4
    Last Post: 06-28-2012, 07:08 AM
  4. selection.find - write a number in the cell next to found cell
    By Sir_Nemo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2012, 07:29 PM
  5. search a cell for values in a range, return values found
    By carpe.cervisiam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-15-2011, 12:52 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