I would like to copy data from one workbook and paste into the next available column of the active workbook.
I have been able to import the data from one workbook and paste it into the active sheet at a specified cell.
Sub ImportData()
Dim FileToOpen As Variant
Dim Openbook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel Files (*.csv*), *csv*")
If FileToOpen <> False Then
Set Openbook = Application.Workbooks.Open(FileToOpen)
Openbook.Sheets(1).Range("B2:B145").Copy
ThisWorkbook.Worksheets(ActiveSheet.Name).Range("B3").PasteSpecial xlPasteValues
Openbook.Close False
End If
Application.ScreenUpdating = True
End Sub
How do I change the range from B3 to the next available column, so it will begin on B3 then C3 then D3 etc., after every workbook I select?