NatetheGreat
Active Member
- Joined
- Nov 18, 2013
- Messages
- 268
HI All,
I've got a spreadsheet that via a Macro Button and some basic code I have written, will copy data into my spreadsheet table from another spreadsheet (via chdir ) . The data pasted in will have a few columns next to it, which have a series of formulas. My question is about the following part of my code
Range("stats[Time]").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
'Chops Extra Rows Off Bottom Table
this is supposed to cut out any excess rows from the table, which are left over when a smaller dataset is copied into the table leaving blank rows at the bottom (and throwing off my formulas).
This works great when there are indeed extra rows, but when I'm copying in a LARGER dataset (i.e. more rows) into my table, the VBA doesn't know what to do and just fails here with a DEBUG, and doesn't execute some additional procedures I have afterwards.
Is there any way to change the above code so that it only executes IF there are indeed extra rows?
I've got a spreadsheet that via a Macro Button and some basic code I have written, will copy data into my spreadsheet table from another spreadsheet (via chdir ) . The data pasted in will have a few columns next to it, which have a series of formulas. My question is about the following part of my code
Range("stats[Time]").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
'Chops Extra Rows Off Bottom Table
this is supposed to cut out any excess rows from the table, which are left over when a smaller dataset is copied into the table leaving blank rows at the bottom (and throwing off my formulas).
This works great when there are indeed extra rows, but when I'm copying in a LARGER dataset (i.e. more rows) into my table, the VBA doesn't know what to do and just fails here with a DEBUG, and doesn't execute some additional procedures I have afterwards.
Is there any way to change the above code so that it only executes IF there are indeed extra rows?