Solved

Check folder existance using cell reference

Posted on 2011-03-14
5
275 Views
Last Modified: 2012-05-11
Hello, Can anyone tell me I get a 'type mismatch' error message with the second version below?
A specific folder reference, as in the first example, works just fine
Many thanks!
If Dir("C:\Backup5", vbDirectory) = "" Then
MkDir "C:\Backup5"
End If

Open in new window

If Dir(Range("S9").Value, vbDirectory) = "" Then
MkDir Range("S9").Value
End If

Open in new window

0
Comment
Question by:davidam
  • 3
  • 2
5 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 35131439
What do you have on cell S9?
0
 

Author Comment

by:davidam
ID: 35131454
C:\Backup5
0
 
LVL 33

Accepted Solution

by:
jppinto earned 500 total points
ID: 35131460
I've tested your code and works fine on my computer...

I've tested putting this:

C:\Test

on cell S9 and it worked fine. No errors presented!
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35131479
Are you sure you don't have spaces on your cell?
0
 

Author Comment

by:davidam
ID: 35131650
So I am actually taking the cell reference from the active workbook and not the workbook that holds the code.  I originally put a procedure directly into the workbook without making a module...now I put it in a module and it works fine.  I dunno.  I will just accept your solution because you made it clear toi me that it should work. Many thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question