Hi Dear
I need your help what's wrong with this code ,
I got seasick with it.
My problem is here with this code, I guess:
ActiveWorkbook.Worksheets("CumulativeData").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
When I run this, it pastes the data from Results worksheet for first run but but creates row number 1 blank from second run. I want my data from row 1 with no header row. Any help with this is highly appreciated.
Code: Select all
Sub Import_data()
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Dim destinationRow As Integer
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your File & Import Range", FileFilter:="Excel CSV Files (*.csv*),*csv*")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.ActiveSheet.Range("A11:R11,A33:R33").Copy
ThisWorkbook.Worksheets("Results").Range("A13").PasteSpecial xlPasteValues
OpenBook.Application.CutCopyMode = False
OpenBook.Close False
Range("A13:A14").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveWorkbook.Worksheets("CumulativeData").Select
destinationRow = ActiveWorkbook.Worksheets("CumulativeData").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveWorkbook.Worksheets("Results").Select
Application.CutCopyMode = False
End If
Application.ScreenUpdating = True
End Sub