#1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 113
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 113
Default 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
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



All times are GMT +1. The time now is 11:12 PM.

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

About Us

"It's about Microsoft Excel"