OK.
I'm trying to write some code that will basically perform the same calculations to a lot of excel files in a folder called "Test Folder". I learned from here that I can use the dir command. Here is my code
All I'm doing on this test run is selecting the value of "A1" which is in the sheet called "Nav" and copying it to sheet2 of the same workbook. After I'm done I save it, close it, move on to next file. The problem is that it doesn't want to put the value on sheet 2.
BUT when I use this code on just one excel file it works.
What is the differece? The guts are pretty much the same but my batch process doesn't like to copy that value to the second sheet.
I'm still pretty newb to this so pardon if this is really easy.
thanks.
I'm trying to write some code that will basically perform the same calculations to a lot of excel files in a folder called "Test Folder". I learned from here that I can use the dir command. Here is my code
Code:
Sub Batchtest()
Dim myFile As String, myCurrFile As String
Dim value1
myCurrFile = ThisWorkbook.Name
myFile = Dir("C:\Test Folder\*.xls")
Do Until myFile = ""
Workbooks.Open "C:\Test Folder\" & myFile
Sheets("Nav").Activate
Range("A1").Select
value1 = ActiveCell.Value
Worksheets(2).Range("A1").Value = value1
ActiveWorkbook.Save
ActiveWorkbook.Close
myFile = Dir
Loop
End Sub
BUT when I use this code on just one excel file it works.
Code:
Sub test()
Dim value1
Sheets("Nav").Activate
Range("A1").Select
value1 = ActiveCell.Value
Worksheets(2).Range("A1").Value = value1
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
What is the differece? The guts are pretty much the same but my batch process doesn't like to copy that value to the second sheet.
I'm still pretty newb to this so pardon if this is really easy.
thanks.