ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF? (https://www.excelbanter.com/excel-programming/310597-if.html)

dan

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

Frank Kabel

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


K Dales

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
.


dan

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

.



All times are GMT +1. The time now is 04:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com