ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows in VB (https://www.excelbanter.com/excel-programming/325670-delete-rows-vbulletin.html)

Neutron1871

Delete Rows in VB
 
I need to create a macro that will search through all customer numbers in a
particular column, and delete the rows that contain customer numbers that
start with a numeral. The customer numbers that start with a letter are the
ones I need. How can I make this happen? I was thinking along the lines of
Find and Replace, but can't figure it out. Can someone help me? Thanks!

Ryan

Jim Thomlinson[_3_]

Delete Rows in VB
 
This might be a silly question, but why not just sort the sheet, which will
float the numerals to the top or bottom and then just delete them from there?
It is manual but easy...

"Neutron1871" wrote:

I need to create a macro that will search through all customer numbers in a
particular column, and delete the rows that contain customer numbers that
start with a numeral. The customer numbers that start with a letter are the
ones I need. How can I make this happen? I was thinking along the lines of
Find and Replace, but can't figure it out. Can someone help me? Thanks!

Ryan


Mudraker

Delete Rows in VB
 
Try this on a backup copy of your data

It assumes account number in column A





Sub DelRecords()
Dim lRow As Long

For lRow = Cells(Rows.Count, "a").End(xlUp).Row _
To 1 Step -1
Select Case Left(Cells(lRow, "a"), 1)
Case 0 To 9
Rows(lRow).Delete
End Select
Next lRow
End Sub






"?B?SmltIFRob21saW5zb24=?=" wrote in message ...
This might be a silly question, but why not just sort the sheet, which will
float the numerals to the top or bottom and then just delete them from there?
It is manual but easy...

"Neutron1871" wrote:

I need to create a macro that will search through all customer numbers in a
particular column, and delete the rows that contain customer numbers that
start with a numeral. The customer numbers that start with a letter are the
ones I need. How can I make this happen? I was thinking along the lines of
Find and Replace, but can't figure it out. Can someone help me? Thanks!

Ryan


Neutron1871

Delete Rows in VB
 
It works. Thank you so much!!!

"Mudraker" wrote:

Try this on a backup copy of your data

It assumes account number in column A





Sub DelRecords()
Dim lRow As Long

For lRow = Cells(Rows.Count, "a").End(xlUp).Row _
To 1 Step -1
Select Case Left(Cells(lRow, "a"), 1)
Case 0 To 9
Rows(lRow).Delete
End Select
Next lRow
End Sub






"?B?SmltIFRob21saW5zb24=?=" wrote in message ...
This might be a silly question, but why not just sort the sheet, which will
float the numerals to the top or bottom and then just delete them from there?
It is manual but easy...

"Neutron1871" wrote:

I need to create a macro that will search through all customer numbers in a
particular column, and delete the rows that contain customer numbers that
start with a numeral. The customer numbers that start with a letter are the
ones I need. How can I make this happen? I was thinking along the lines of
Find and Replace, but can't figure it out. Can someone help me? Thanks!

Ryan




All times are GMT +1. The time now is 11:18 AM.

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