Solved

Check folder existance using cell reference

Posted on 2011-03-14
5
274 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

825 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