View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
[email protected] ucanalways@gmail.com is offline
external usenet poster
 
Posts: 115
Default Macro to assign cell values as folder name

On Oct 23, 5:17 pm, "Rick Rothstein \(MVP - VB\)"
wrote:
Rick, Got this working:


Sub RenameFolders1()
Dim X As Long
For X = 1 To 11
Name "C:\test\" & CStr(X) As "C:\test\" &
Worksheets("Sheet1").Range("A" & CStr(X)).Value
Next
End Sub


I used F8 and found that the line after the if loop was not executing.
So, I removed the if loop and got it working.. But still wondering why
the if loop didnt do the trick


I put the If-Then test in there to stop errors that could result if the
folder didn't exist for some reason or if the cell was empty. As long as you
are sure the folders are all there and that the cells all have text in them,
you should be alright without it... but I would rather see it there myself.
Since I test the same things I use in the Name..As statement, I am a little
puzzled as to why the If-Then test was blocking you. I'm on my way out for
the evening; but if you still want me to send you my test file, I will do so
later on this evening... just let me know.

Rick


Rick, please send the file to me. Thanks. My email id is