Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Sean Anderson   on Aug 19 In MS Office Category.

  
Question Answered By: Heru Chalthoum    on Aug 19

I have been trying this

Sub Macro1()
Dim sFileName As String
Dim bWkb As Workbook
Dim Wkb As Workbook
Dim Wks As Worksheet
Dim sPath As String
sPath = "C:\Documents and Settings\MICKY\Desktop\raja\"
sFileName = Dir(sPath & "*.xls")
Set bWkb = ThisWorkbook
Do While sFileName <> ""
Set Wkb = Workbooks.Open(sPath & sFileName)
For RowOffset = 0 To 2
For ColOffset = 0 To 3
Wkb.Worksheets("Sheet1").Range("A1") _
.Offset(RowOffset, ColOffset + 4) = _
bWkb.Worksheets("Sheet1").Range("A1") _
.Offset(RowOffset, ColOffset)
Next
Next
sFileName = Dir
Wkb.Close SaveChanges:=True
Loop
End Sub

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on loop thorugh a column and copy to matching workbook Or get search suggestion and latest updates.


Tagged: