ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows - Must be dynamic (https://www.excelbanter.com/excel-programming/346304-delete-rows-must-dynamic.html)

Tony P.[_3_]

Delete Rows - Must be dynamic
 
Okay, I am self taught so bear with me while I try to explain. I pull
data files from a retailer's system that come back with header information.
The header can take up anywhere from 4-50+ rows. Column A is always blank in
the data file header. I am trying to write a macro that deletes these data
file headers without deleting my spreadsheet column headers. Here is what I
have so far, but this deletes my column headers as well:

Rows("1:1").Select
Range(Selection, Selection.End(xlDown)).Delete

I know there has to be a way to make the selection go back up one row before
I delete but I sure cannot figure out how. Any help is much appreciated!

Tony

bpeltzer

Delete Rows - Must be dynamic
 
Rows("1:1").Select
Range(Selection, Selection.End(xlDown).Offset(-1, 0)).Delete

"Tony P." wrote:

Okay, I am self taught so bear with me while I try to explain. I pull
data files from a retailer's system that come back with header information.
The header can take up anywhere from 4-50+ rows. Column A is always blank in
the data file header. I am trying to write a macro that deletes these data
file headers without deleting my spreadsheet column headers. Here is what I
have so far, but this deletes my column headers as well:

Rows("1:1").Select
Range(Selection, Selection.End(xlDown)).Delete

I know there has to be a way to make the selection go back up one row before
I delete but I sure cannot figure out how. Any help is much appreciated!

Tony


Tony P.[_3_]

Delete Rows - Must be dynamic
 
Beautiful! Thank you!!!!!!!

"bpeltzer" wrote:

Rows("1:1").Select
Range(Selection, Selection.End(xlDown).Offset(-1, 0)).Delete

"Tony P." wrote:

Okay, I am self taught so bear with me while I try to explain. I pull
data files from a retailer's system that come back with header information.
The header can take up anywhere from 4-50+ rows. Column A is always blank in
the data file header. I am trying to write a macro that deletes these data
file headers without deleting my spreadsheet column headers. Here is what I
have so far, but this deletes my column headers as well:

Rows("1:1").Select
Range(Selection, Selection.End(xlDown)).Delete

I know there has to be a way to make the selection go back up one row before
I delete but I sure cannot figure out how. Any help is much appreciated!

Tony



All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com