Hi,
This forum was always helpful to me in solving the queries which is the reason i come back and again whenever i face a problem with VBA.
I was trying to open the alternate workbooks in the folder dallas and perform some copy and paste of the sheets.
The hardest part was to open the alternate workbooks such as first,third and fifth so on.........leaving the second,fourth,sixth..........
I wrote the below code which i thought should be working but when i really executed the macro,it is always opening the first workbook only..
I dont understand what is the incorrect in the below code.Can someone help me out there............
Sub files()
Dim myfile As String
Dim wb As Workbook
Dim i As Integer
i = 1
myfile = Dir("C:\dallas\*xls")
Do Until myfile = ""
If (i Mod 2 = 1) Then
Set wb = Workbooks.Open("C:\dallas\" & myfile)
\\copy the required sheets\\
wb.Close Savechanges
Else
MsgBox "number is not odd"
End If
sname = Dir()
i = i + 1
Loop
End Sub
Bookmarks