Check folder existance using cell reference

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

Question by:davidam
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 33

Expert Comment

ID: 35131439
What do you have on cell S9?

Author Comment

ID: 35131454
LVL 33

Accepted Solution

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

I've tested putting this:


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

Expert Comment

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

Author Comment

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 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!

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

752 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