Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF?
Hi:
Ho do I delete a row that strats for ex: with "node... This is not working, unless I am putting in the code the hole sentence: If ActiveCell.Value.left = "Node *" ActiveCell.EntireRow.Delete ActiveCell.Offset(-1, 0).Select End If ActiveCell.Offset(1, 0).Select Loop ActiveCell.ClearContents Range("A1").Select Application.ScreenUpdating = TrueIf ActiveCell.Value.left = "Node *" then Thanks, Dan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF?
Hi
try the following macro: Sub delete_rows() Dim lastrow As Long Dim row_index As Long Application.ScreenUpdating = False lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For row_index = lastrow - 1 To 1 Step -1 If left(Cells(row_index, 1).Value,4) = "node" then rows(row_index).delete End If Next Application.ScreenUpdating = True End Sub also have a look at: http://www.xldynamic.com/source/xld.Deleting.html -- Regards Frank Kabel Frankfurt, Germany Dan wrote: Hi: Ho do I delete a row that strats for ex: with "node... This is not working, unless I am putting in the code the hole sentence: If ActiveCell.Value.left = "Node *" ActiveCell.EntireRow.Delete ActiveCell.Offset(-1, 0).Select End If ActiveCell.Offset(1, 0).Select Loop ActiveCell.ClearContents Range("A1").Select Application.ScreenUpdating = TrueIf ActiveCell.Value.left = "Node *" then Thanks, Dan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF?
Instead of equals, use the LIKE comparison operator:
If ActiveCell.Value LIKE "Node *" ... -----Original Message----- Hi: Ho do I delete a row that strats for ex: with "node... This is not working, unless I am putting in the code the hole sentence: If ActiveCell.Value.left = "Node *" ActiveCell.EntireRow.Delete ActiveCell.Offset(-1, 0).Select End If ActiveCell.Offset(1, 0).Select Loop ActiveCell.ClearContents Range("A1").Select Application.ScreenUpdating = TrueIf ActiveCell.Value.left = "Node *" then Thanks, Dan . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
IF?
Thank you very much!
Dan -----Original Message----- Hi try the following macro: Sub delete_rows() Dim lastrow As Long Dim row_index As Long Application.ScreenUpdating = False lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row For row_index = lastrow - 1 To 1 Step -1 If left(Cells(row_index, 1).Value,4) = "node" then rows(row_index).delete End If Next Application.ScreenUpdating = True End Sub also have a look at: http://www.xldynamic.com/source/xld.Deleting.html -- Regards Frank Kabel Frankfurt, Germany Dan wrote: Hi: Ho do I delete a row that strats for ex: with "node... This is not working, unless I am putting in the code the hole sentence: If ActiveCell.Value.left = "Node *" ActiveCell.EntireRow.Delete ActiveCell.Offset(-1, 0).Select End If ActiveCell.Offset(1, 0).Select Loop ActiveCell.ClearContents Range("A1").Select Application.ScreenUpdating = TrueIf ActiveCell.Value.left = "Node *" then Thanks, Dan . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|