+ Reply to Thread
Results 1 to 4 of 4

Create folder based on cell value

  1. #1
    Registered User
    Join Date
    11-03-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    23

    Create folder based on cell value

    Hi All,

    I have a query. Please find attached sheet. In attached sheet I put a function for today’s date (which is =today()), next to this one command button with name ‘Create Folder’.

    What I want to achieve is, when I click on command button excel create a folder with the cell value in B2 (which is 2day’s date).

    I have written this code but it’s not working.

    Can anyone help me with this?

    Thanks


    Private Sub CommandButton1_Click()

    MakeFolders

    End Sub

    Sub MakeFolders()

    Dim x As String

    With ActiveSheet

    x = .Range("B2").Value

    If x > 0 Then
    MkDir (ActiveWorkbook.Path & "H:\Others\VBA\" & x("B2"))

    End If

    End With

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Create folder based on cell value

    try something like this...

    Please Login or Register  to view this content.
    you can change the C: to activeworkbook.path....I just changed it to C: for testing
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Registered User
    Join Date
    11-03-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Create folder based on cell value

    It works thanks judgeh59

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Create folder based on cell value

    Glad I could help...

    Thanks for setting the thread to Solved...If you feel I deserve an increase in my reputation, feel free to click on the star in the lower left of the thread. Remember, someday when you help somebody they may add to your rep points, and it could be me...just a thought...

+ 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. Simple: Create folder based on cell value
    By Hooty in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-07-2012, 11:21 AM
  2. Replies: 5
    Last Post: 09-13-2012, 09:49 AM
  3. Replies: 1
    Last Post: 09-12-2012, 11:29 AM
  4. [SOLVED] Create a new folder based on a cell name or value and save copy onto that folder
    By Le_Tiago in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-20-2012, 01:33 PM
  5. Macro to save duplicate file and create folder name based on cell value
    By munkee in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-19-2012, 12:09 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