VBA Format Number With Leading ZeroFeb 13, 2007
I have the following script which is working fine execpt for its limited to running the loop 10 times. The macro is looking for files where the file extension could be anything between .P01 and .P99. Currently, the macro looks for file.P01 then file.P02 etc until it gets to file.P09 by increasing the value of 'i'. The trouble I am having is to get the variable 'i' to have a leading zero when the value is less than 10.
Dim OldName, NewName
Dim i As Integer
Dim strResult, strOldName, strNewName As String
Range("E14").Activate ' set first file
Application.DisplayAlerts = False