Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Remove all rows that contain letters

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Remove all rows that contain letters

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove 1st 2 letters in each row Cathy Excel Discussion (Misc queries) 1 December 15th 09 02:01 PM
Remove dashes between letters and between letters and digits [email protected] Excel Worksheet Functions 7 March 5th 08 06:08 PM
How can I remove a space between a letters and set of numbers? connie Excel Discussion (Misc queries) 5 July 2nd 07 04:31 PM
Remove all rows that contain letters fred Excel Programming 1 February 15th 05 03:22 PM
Remove letters from a cell Steve Excel Programming 10 October 2nd 04 04:32 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"