+ Reply to Thread
Results 1 to 3 of 3

Create a filename after validation

  1. #1
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Durham
    MS-Off Ver
    2013
    Posts
    126

    Create a filename after validation

    Hi all,

    I'm looking to create a file name after it's been picked up and validated that it exists. The format I'm thinking is along the lines of:

    The Filename will be - FruitName + Date (The fruit will be input into A1)

    So:

    Pull the Fruit from A1 and validate again as list of fruit using a Booleon
    If true then Continue
    If not then a userform pops up forcing them to slelect a fruit

    Then Count the fruit length i.e. Fruitlength - Len(Fruit)
    Then length of fruit + 8 (As the date will always be 8 i.e. 29/03/2017)

    Then Loop through a folder stating 'if left 'whatever the total length of Fruit + Date was" = Fruit name
    If its found then count Plus 1 and save

    I.e. If It was Banana29032017 then save as Banana2903201701
    If Banana2903201701 existed then save as Banana2903201702

    I hope that makes sense - I think I'm pretty much there structure wise

    Any help on the writing?

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,014

    Re: Create a filename after validation

    This assumes that you have a valid list of Fruit Names in a range named FruitNames. You can modify it as needed - post back if you need further help.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Durham
    MS-Off Ver
    2013
    Posts
    126

    Re: Create a filename after validation

    Hi Bernie,

    Thanks for your reply

    At first glance that looks spot on! I do have a list of FruitNames however it's in column B (B1:B400) IN another work that will also be open so I shall have to reference that, or possibly just create a hidden sheet within this workbook....that would probably be easier.

    I've changed Exit Sub to:

    Please Login or Register  to view this content.
    To force the user to put a fruit in the cell rather than just close it too!

    I'll test it tomorrow when I have access, thanks again for your help

+ 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. [SOLVED] Concat String and Integer variables to create filename
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-03-2014, 07:14 AM
  2. [SOLVED] Create Unique Automated Filename When Saving
    By Rosco88 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-28-2013, 06:46 AM
  3. [SOLVED] How to create Pdf filename base on ws Range.Value
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-10-2012, 11:28 PM
  4. Code to create a custom .csv filename with version stamp in filename
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-10-2012, 04:07 AM
  5. Create Unique Filename
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-11-2009, 11:49 AM
  6. Create and import filename list into excel
    By Jim Semaj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-12-2005, 02:10 PM
  7. [SOLVED] Create filename from three cells and get to clippboard
    By Booker in forum Excel General
    Replies: 4
    Last Post: 11-14-2005, 04:45 AM

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