Hi All
Good day for you........
I Run below code i get run-time error. Please need you help
Good day for you........
I Run below code i get run-time error. Please need you help
Code:
Sub GetFileCopyData()
Dim Fname As String
Dim SrcWbk As Workbook
Dim DestWbk As Workbook
Set DestWbk = ThisWorkbook
Fname = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*), *.xls*", Title:="Select a File")
If Fname = "False" Then Exit Sub
Set SrcWbk = Workbooks.Open(Fname)
If Evaluate("isref('Support_Details'!a1)") Then
Sheets("Support_Details").Select
Cells.Find(What:="Company #", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Worksheets("sheet1").Activate
Range("A1").PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Type of company", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("b1").PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Doc ID", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("c1").PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="QC final remarks (Observation/Not Applicable)", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("d1").PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Root Cause", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("e1").PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="QC doc delivery date", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("f1").PasteSpecial
SrcWbk.Activate
Cells.Find(What:="CTQ Quality%", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("g1").PasteSpecial
SrcWbk.Activate
Cells.Find(What:="Document Acceptance", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
DestWbk.Activate
Range("H1").PasteSpecial xlPasteValues
End If
SrcWbk.Activate
If Evaluate("isref('Dummy_prime_Doc details'!a1)") Then
Sheets("Dummy_prime_Doc details").Select
Cells.Find(What:="Company #", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
Range("A1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Type of company", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
'''''''Range("b1").PasteSpecial
Range("B1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Doc ID", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
Range("C1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="QC Comments", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
''''''''Range("c1").PasteSpecial
Range("D1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Root Cause", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
''''''Range("d1").PasteSpecial
Range("E1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="QC doc delivery date", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
''''''Range("e1").PasteSpecial
Range("F1").End(xlDown).Offset(1, 0).PasteSpecial
SrcWbk.Activate
Cells.Find(What:="CTQ Quality%", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
'''''Range("f1").PasteSpecial
Range("G1").End(xlDown).Offset(1, 0).PasteSpecial
SrcWbk.Activate
Cells.Find(What:="Document Acceptance", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
''''''''''Range("g1").PasteSpecial
Range("H1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
End If
SrcWbk.Activate
If Evaluate("isref('New support_Doc_details'!a1)") Then
Sheets("New support_Doc_details").Select
Cells.Find(What:="Company #", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
'''''''Range("A1").PasteSpecial
Range("A1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Type of company", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
'''''''''Range("b1").PasteSpecial
Range("B1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Doc ID", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
Range("c1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="QC final Comments", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
Range("D1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="Root Cause", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
''''''''Range("d1").PasteSpecial
Range("E1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
SrcWbk.Activate
Cells.Find(What:="QC doc delivery date", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
''''''''Range("e1").PasteSpecial
Range("F1").End(xlDown).Offset(1, 0).PasteSpecial
SrcWbk.Activate
Cells.Find(What:="CTQ Quality%", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
'''''''Range("f1").PasteSpecial
Range("G1").End(xlDown).Offset(1, 0).PasteSpecial
SrcWbk.Activate
Cells.Find(What:="Document Acceptance", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Offset(1, 0).Copy
DestWbk.Activate
'''''''Range("g1").PasteSpecial
Range("H1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteValues
End If
SrcWbk.Close False
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Worksheets("sheet2").Select
Range("A1").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial
End Sub
Last edited by a moderator: