Satheesh9012
New Member
- Joined
- Mar 19, 2021
- Messages
- 41
- Office Version
- 365
- Platform
- Windows
Hi Team,
I am trying to use the below code to copy data from two worksheets and paste it in the different workbook sheet, however while doing this only one work sheet is getting copy and pasted in the destination worksheet, however second worksheet doesn get copy pasted, below code for your reference and please let me know if i am missing some part,
Sub Import1()
'
' Import Macro
'
Application.ScreenUpdating = False
'************************to browse and select the file*****************************
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xls* (*.xls*),")
If strFileToOpen = False Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Set Wb = Workbooks.Open(strFileToOpen)
End If
Dim lo As ListObject
Dim icol As Long
ThisWorkbook.Activate
Sheets("Template").Select
Wb.Activate
Sheets("Learning Admin").Select
Worksheets("Learning Admin").Range("A1").AutoFilter Field:=2, Criteria1:= _
"=Ready", Operator:=xlOr, Criteria2:="=Work in Progress"
Range("A2:J2", Range("A65536:J65536").End(xlUp)).Select
Selection.Copy
ThisWorkbook.Activate
ActiveSheet.Paste Destination:=Worksheets("Input Data").Range("A2")
Wb.Activate
Sheets("BeSpoke").Select
Worksheets("BeSpoke").Range("A1").AutoFilter Field:=2, Criteria1:= _
"=Ready", Operator:=xlOr, Criteria2:="=Work in Progress"
Range("A2:J2", Range("A65536:J65536").End(xlUp)).Select
Selection.Copy
ThisWorkbook.Activate
Worksheets("Input Data").Select
ActiveSheet.Paste Destination:=Worksheets("Input Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
it will be helpfull if a speedy response is recieved many thanks
I am trying to use the below code to copy data from two worksheets and paste it in the different workbook sheet, however while doing this only one work sheet is getting copy and pasted in the destination worksheet, however second worksheet doesn get copy pasted, below code for your reference and please let me know if i am missing some part,
Sub Import1()
'
' Import Macro
'
Application.ScreenUpdating = False
'************************to browse and select the file*****************************
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xls* (*.xls*),")
If strFileToOpen = False Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Set Wb = Workbooks.Open(strFileToOpen)
End If
Dim lo As ListObject
Dim icol As Long
ThisWorkbook.Activate
Sheets("Template").Select
Wb.Activate
Sheets("Learning Admin").Select
Worksheets("Learning Admin").Range("A1").AutoFilter Field:=2, Criteria1:= _
"=Ready", Operator:=xlOr, Criteria2:="=Work in Progress"
Range("A2:J2", Range("A65536:J65536").End(xlUp)).Select
Selection.Copy
ThisWorkbook.Activate
ActiveSheet.Paste Destination:=Worksheets("Input Data").Range("A2")
Wb.Activate
Sheets("BeSpoke").Select
Worksheets("BeSpoke").Range("A1").AutoFilter Field:=2, Criteria1:= _
"=Ready", Operator:=xlOr, Criteria2:="=Work in Progress"
Range("A2:J2", Range("A65536:J65536").End(xlUp)).Select
Selection.Copy
ThisWorkbook.Activate
Worksheets("Input Data").Select
ActiveSheet.Paste Destination:=Worksheets("Input Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
it will be helpfull if a speedy response is recieved many thanks