PDA

View Full Version : Solved: Drive Letter



justdriving
09-10-2011, 04:23 AM
I need help to correct this code:-


Sub drl()
If Cells(65536.256).Value Is Nothing Then
DriveL = InputBox("Please specify your Drive Alphabet where File exists: ", "JustDrivingSoft", "C")
Cells(65536, 256).Value = DriveL
Else
DriveL = Cells(65536, 256).Value
End If

End Sub


Is there a permanent way, that even after closing file, my program will remember the Drive Letter input by me? It will not ask again through Inputbox.

Bob Phillips
09-10-2011, 04:53 AM
Won't it know because it is now stored in the worksheet?

GTO
09-10-2011, 05:17 AM
Howdy All,


In your first Cells(), you need a comma, not a full-stop. Also, you cannot test for Is Nothing against a string. Try:
Sub drl()
Dim DriveL As String

If Cells(65536, 256).Value = vbNullString Then
DriveL = InputBox("Please specify your Drive Alphabet where File exists: ", "JustDrivingSoft", "C")
Cells(65536, 256).Value = DriveL
Else
DriveL = Cells(65536, 256).Value
End If

End Sub

justdriving
09-10-2011, 12:29 PM
Thanks XLD and GTO. It worked. I will be glad to be help to you both.