Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I need to create a macro to delete all rows where column A has text. Can
anyone tell me any easy way to do this? |
#2
![]() |
|||
|
|||
![]()
One way:
Public Sub DeleteRowsWithTextInColumnA() On Error Resume Next 'in case no text Columns(1).SpecialCells( _ xlCellTypeConstants, xlTextValues).EntireRow.Delete On Error GoTo 0 End Sub In article , "D Hafer - TFE" wrote: I need to create a macro to delete all rows where column A has text. Can anyone tell me any easy way to do this? |
#3
![]() |
|||
|
|||
![]()
Actually, I'd like to remove the rows where column A is blank also, let's say
for just the first 300 rows in a sheet. How would this code change? "JE McGimpsey" wrote: One way: Public Sub DeleteRowsWithTextInColumnA() On Error Resume Next 'in case no text Columns(1).SpecialCells( _ xlCellTypeConstants, xlTextValues).EntireRow.Delete On Error GoTo 0 End Sub In article , "D Hafer - TFE" wrote: I need to create a macro to delete all rows where column A has text. Can anyone tell me any easy way to do this? |
#4
![]() |
|||
|
|||
![]()
One way:
Public Sub DeleteRowsWithTextOrBlanksInA1ToA300() Dim rDelete On Error Resume Next 'in case no text or blanks With Range("A1:A300") Set rDelete = .SpecialCells( _ xlCellTypeConstants, xlTextValues) If rDelete Is Nothing Then Set rDelete = .SpecialCells(xlCellTypeBlanks) Else Set rDelete = Union(rDelete, _ .SpecialCells(xlCellTypeBlanks)) End If If Not rDelete Is Nothing Then rDelete.EntireRow.Delete End With On Error GoTo 0 End Sub In article , "D Hafer - TFE" wrote: Actually, I'd like to remove the rows where column A is blank also, let's say for just the first 300 rows in a sheet. How would this code change? "JE McGimpsey" wrote: One way: Public Sub DeleteRowsWithTextInColumnA() On Error Resume Next 'in case no text Columns(1).SpecialCells( _ xlCellTypeConstants, xlTextValues).EntireRow.Delete On Error GoTo 0 End Sub In article , "D Hafer - TFE" wrote: I need to create a macro to delete all rows where column A has text. Can anyone tell me any easy way to do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formulas dealing with text data | Excel Worksheet Functions | |||
Selective deletion of rows containing certain text. | Excel Worksheet Functions | |||
generate multiple rows based on cell value | Excel Worksheet Functions | |||
Sort or Filter option? | Excel Worksheet Functions | |||
Formula to compare multiple rows values based on another column? | Excel Worksheet Functions |