Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to create a macro or something to remove an entire row, if any
cell in the row contains any letter.I plan to use a button to automate the process. Thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This sub will do it, if by "contains any letter" you mean "contains any
non-numeric cell." You need to supply the range - any continuous range that spans the rows you want to check. It uses the COUNT function and the COUNTA function as a way of finding non-numeric cells (since these will differ if there are any). Public Sub RemoveAlphaRows(RowsToCheck As Range) Dim RowNo As Integer, CheckRow As Range Dim NumCount As Integer, AllCount As Integer For RowNo = RowsToCheck.Rows.Count To 1 Step -1 Set CheckRow = RowsToCheck.Range("A1").Offset(RowNo - 1, 0).EntireRow NumCount = WorksheetFunction.Count(CheckRow) AllCount = WorksheetFunction.CountA(CheckRow) If AllCount < NumCount Then CheckRow.Delete Next RowNo End Sub "fred" wrote: I'm trying to create a macro or something to remove an entire row, if any cell in the row contains any letter.I plan to use a button to automate the process. Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
remove 1st 2 letters in each row | Excel Discussion (Misc queries) | |||
Remove dashes between letters and between letters and digits | Excel Worksheet Functions | |||
How can I remove a space between a letters and set of numbers? | Excel Discussion (Misc queries) | |||
Remove all rows that contain letters | Excel Programming | |||
Remove letters from a cell | Excel Programming |