Thread: open workbook
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default open workbook

Cheers..

If this post helps click Yes
---------------
Jacob Skaria


"Ranjith Kurian" wrote:

thanks a lot

"Jacob Skaria" wrote:

Try this untested code....

Sub test()

Dim intTemp As Integer
Dim arrWorkBook As Variant

arrWorkBook = Array("AU.xls", "BU.xls", "DU.xls", "EF.xls")

For intTemp = 0 To UBound(arrWorkBook)
Workbooks.Open Filename:="C:\N\" & arrWorkBook(intTemp)
Rows("1:1").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Next
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Ranjith Kurian" wrote:

I have created a macro code to formate my excel file below is the code

sub test()
ChDir "C:\N"
Workbooks.Open Filename:="C:\N\AU.xls"
Rows("1:1").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End sub

The above code work only in file AU.xls, i would like to have a short macro
code to open my other three files (BU.xls, DU.xls, EF.xls) and perform the
same action to it.

Is it possible to put the formate part in loop.