VBA Macro - Import data from different excel file for a given value
Hello guys,
I am very unprepared in everything that means VBA Macros but still I have to find a solution to make my work easier. :banghead:
If you don't mind, I'd like to share with you where I got stuck.
In one file I need some data from another file but not all the lines.
In the file where I have to get my data from, I have the following columns:
Code:
row_no. |
task |
user_id |
upload_date |
week_no. |
year |
asin |
Marketplace |
Keywords_for_upload |
GL |
PL |
I would like, if possible, to import my lines for a value of the "week_no" column that I can add next to the button.
That's what I've managed to do so far, only I can't handle the condition for that "range":
Code:
Sub Get_Data_From_File()
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = "C:\Source.xlsx"
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.Sheets(1).Range("B1:K52").Copy
ThisWorkbook.Worksheets(2).Range("A1").PasteSpecial xlPasteValues
OpenBook.Close False
End If
Application.ScreenUpdating = True
End Sub
I hope I was quite explicit and thank you in advance for your help.