Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Check folder existance using cell reference

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
davidam
Asked:
davidam
  • 3
  • 2
1 Solution
 
jppintoCommented:
What do you have on cell S9?
0
 
davidamAuthor Commented:
C:\Backup5
0
 
jppintoCommented:
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
 
jppintoCommented:
Are you sure you don't have spaces on your cell?
0
 
davidamAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now