B
Buffyslay
hi there
i am trying to copy data from various workbooks in excel -(open ones) i
dont know the names, but i do know the sheet is called sheet1 (i
know....)
i need the data to be put into wbMaster (main doc already referenced) -
but when it gets to
Windows(wbMaster).Activate
Workbooks(wbMaster).Worksheets("Return").Activate
(trying both)
it doesn't activate the wbMaster doc.... ??
code below*
*****************************************************************************************************
If wkb.Name <> wbMaster Then
If Windows(wkb.Name).Visible Then
wkb.Activate
For Each ws In wkb
If ws.Name = "Sheet1" Then
' copy all the data into the COMPARE wb
Worksheets("Sheet1").Activate
lRowCount = ActiveSheet.UsedRange.Rows.Count - 1
iColCount = ActiveSheet.UsedRange.Columns.Count
Range("A2", Range("A2").Offset(lRowCount,
iColCount)).Select
Selection.Copy
Windows(wbMaster).Activate
Workbooks(wbMaster).Worksheets("Return").Activate
MsgBox ActiveWorkbook.Name
lRowCountReturnTemp = ActiveSheet.UsedRange.Rows.Count
- 1
Range("A2").Offset(lRowCountReturnTemp, 0).Activate
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End If
Next
End If
'ListBox1.AddItem wkb.Name
End If
i am trying to copy data from various workbooks in excel -(open ones) i
dont know the names, but i do know the sheet is called sheet1 (i
know....)
i need the data to be put into wbMaster (main doc already referenced) -
but when it gets to
Windows(wbMaster).Activate
Workbooks(wbMaster).Worksheets("Return").Activate
(trying both)
it doesn't activate the wbMaster doc.... ??
code below*
*****************************************************************************************************
If wkb.Name <> wbMaster Then
If Windows(wkb.Name).Visible Then
wkb.Activate
For Each ws In wkb
If ws.Name = "Sheet1" Then
' copy all the data into the COMPARE wb
Worksheets("Sheet1").Activate
lRowCount = ActiveSheet.UsedRange.Rows.Count - 1
iColCount = ActiveSheet.UsedRange.Columns.Count
Range("A2", Range("A2").Offset(lRowCount,
iColCount)).Select
Selection.Copy
Windows(wbMaster).Activate
Workbooks(wbMaster).Worksheets("Return").Activate
MsgBox ActiveWorkbook.Name
lRowCountReturnTemp = ActiveSheet.UsedRange.Rows.Count
- 1
Range("A2").Offset(lRowCountReturnTemp, 0).Activate
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End If
Next
End If
'ListBox1.AddItem wkb.Name
End If