Hello All
I write a macro that will open files with inputbox to search header for date. When it finds date, it will copy the range lines 101: 119 and paste them into ThisWorkbook at the Range of my choice. However, I ran into a problem right from the start in the headers search. I got error :
End Sub
I write a macro that will open files with inputbox to search header for date. When it finds date, it will copy the range lines 101: 119 and paste them into ThisWorkbook at the Range of my choice. However, I ran into a problem right from the start in the headers search. I got error :
Run-time error '1004' - Method 'Range' of object'_Global' failed
Rich (BB code):
Sub Macro10()
Dim data_wb As Workbook
Dim target_wb As Workbook
Dim file_name As Variant
Dim header_range(100) As Range
Dim x As Variant
Dim Col As Long
'Open file
file_name = Application.GetOpenFilename(Title:="Choose a target Workbook")
If file_name <> False Then
'Setworkbook
Set target_wb = ThisWorkbook
'Set data file
Set data_wb = Application.Workbooks.Open(file_name)
'Input box
x = InputBox("Please probide Data YYYY/MM/DD")
target_wb.Close
End If