Hi, I am having some trouble copying data from external workbooks.
The macro should merge several workbooks with the same format into one worksheet in the WB running the macro (wbCodeBook). The part I am having trouble with now is pasting the columns from the other worksheets into wbCodeBook. What I want it to do is copy a set of columns from the source WS and append them to whatever is already in wbCodeBook. I'm using cells.count to find the row to append to, because for now I'm assuming the count+1 is the index of the next row to paste to.
Specifically, my problem now is the way I am trying to copy/paste does not actually paste anything. No errors are thrown either.
Here is the portion where I am doing the copy/paste:
[vba]For lCount = 1 To .FoundFiles.Count 'Loop through all other xls files
NumEntries = wbCodeBook("Sheet1").Range("A:A").Cells.SpecialCells(xlCellTypeConstants).C ount
rwIndx = NumEntries + 1
If .FoundFiles(lCount) <> wbCodeBook.FullNameURLEncoded Then
'Open Workbook x and Set wbResults to it
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
wbResults.Sheets(1).Columns("A:I").Copy wbCodeBook("Sheet1").Range("A" & rwIndx & ":I" & rwIndx)
MsgBox "A" & rwIndx & ":I" & rwIndx
'wbResults.Close SaveChanges:=False
End If
Next lCount[/vba]
I'm guessing one of my problems is that I'm copying a column and trying to paste it to a range, but I'm not sure how to better move the data right now.
Thanks for the help.