Roy_Excel_Island_Apps
Board Regular
- Joined
- Oct 9, 2018
- Messages
- 76
- Office Version
- 365
- Platform
- Windows
Hi everyone!
I'm searching for code to import a data range into my empty table. I always get error 91 on the last line because the table is empty, so doesn't have cell1,1:
' CLEAR DATA IN TABLE
Set tblBusCollection = shtBusCollection.ListObjects("tblBusCollection")
tblBusCollection.DataBodyRange.Delete
' SET RANGE TO COPY
Dim rngCopy As Range
Set rngCopy = src.Worksheets("Bus&Collection").Range("A2:R" & LRrap)
Dim destRange As Range
Set destRange = tbl.DataBodyRange.Cells(1, 1)
destRange.Resize(rngPaste.Rows.Count, rngPaste.Columns.Count).Value = rngPaste.Value
I don't want to paste the range in cel A2 (first cell from table) because the table could shift down of to the right...
Does someone have a solution?
Regards, Roy
I'm searching for code to import a data range into my empty table. I always get error 91 on the last line because the table is empty, so doesn't have cell1,1:
' CLEAR DATA IN TABLE
Set tblBusCollection = shtBusCollection.ListObjects("tblBusCollection")
tblBusCollection.DataBodyRange.Delete
' SET RANGE TO COPY
Dim rngCopy As Range
Set rngCopy = src.Worksheets("Bus&Collection").Range("A2:R" & LRrap)
Dim destRange As Range
Set destRange = tbl.DataBodyRange.Cells(1, 1)
destRange.Resize(rngPaste.Rows.Count, rngPaste.Columns.Count).Value = rngPaste.Value
I don't want to paste the range in cel A2 (first cell from table) because the table could shift down of to the right...
Does someone have a solution?
Regards, Roy