Hello,
I am trying to write a program to delete a row if column J contains any sort of text. The text in column J is not the same. Any help is appreciated!
TIA
Hello,
I am trying to write a program to delete a row if column J contains any sort of text. The text in column J is not the same. Any help is appreciated!
TIA
Last edited by tactical; 05-30-2012 at 03:24 PM.
*Untested*
Please make a copy of your workbook and test on the copy. If you are unfamiliar with how to run the code, please use the instructions in my signature.
![]()
Sub DeleteRow() Dim rngSearch As Range Dim rngCell As Range 'You will need to change the sheet name if different from "Sheet1" Set rngSearch = ActiveWorkbook.Sheets("Sheet1").Range("J1", Range("J1").End(xlDown)) For Each rngCell In rngSearch If Application.WorksheetFunction.IsText(Range(rngCell)) Then rngCell.EntireRow.Delete End If Next rngCell End Sub
Perhaps it was the Noid who should have avoided me...
If you are satisfied with my solution click the small star icon on the left. Thanks
1. Make a copy of your workbook and run the following code on your copy (just in case)
2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
3. Paste the code from above into the empty white space. Close the VBE.
4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".
I have used this one.
Columns(11) = "J"![]()
Sub wis_niet_lege_rijen_oeldere() Columns(11).SpecialCells(2).EntireRow.Delete 'cells contains text Columns(11).SpecialCells(-4123).EntireRow.Delete 'cells contains formula If Err.Number <> 0 Then MsgBox "There are no empty cells" End Sub
Last edited by oeldere; 05-30-2012 at 04:44 PM. Reason: changed text used
you are right => J= colomn 10![]()
J is actually column 10
I send you my example.
first run macro
Sub delete_NOT_empty_row_in_columnC_oeldere()
then run
Sub delete_empty_row_in_columnA()
This one works fine for me.
![]()
Sub hsv() Dim i As Long Application.ScreenUpdating = False For i = Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1 If Cells(i, 10) = "" Then Cells(i, 10).EntireRow.Delete Next i End Sub
Harry.
Use:
![]()
<> ""
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks