Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete row programmatically
Is it possible to delete a row on a sheet programmatically? If say data in
A4, A7, A37 contained the word "delete" could it be possible for code to find the word "delete" colA and then proceed to delete the entire row? Any thoughts about whether this is possible? Pat |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete row programmatically
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 Cells(row_index, 1).Value = "delete" 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 Pat wrote: Is it possible to delete a row on a sheet programmatically? If say data in A4, A7, A37 contained the word "delete" could it be possible for code to find the word "delete" colA and then proceed to delete the entire row? Any thoughts about whether this is possible? Pat |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete row programmatically
Sub TryThis()
Dim X As Long Dim Y As Long Y = Range("A65536").End(xlUp).Row 'y= find the last non empty cell in column A For X = Y To 1 Step -1 'Lcase gets the lower case of the word If lcase(Cells(X, 1).Value) = "delete" Then Rows(X).Delete End If Next -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I delete rows programmatically based on certain criteria? | New Users to Excel | |||
How can I delete rows programmatically based on certain criteria? | Excel Worksheet Functions | |||
How to delete lines programmatically if a condition is met? | Excel Discussion (Misc queries) | |||
Delete modules programmatically and save | Excel Programming | |||
Excel VBA Programmatically delete a form? | Excel Programming |