Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search from bottom of column up column and delete to top
New to Excel VBA, trying to find out:
1. How to search (or find) from the bottom of a column upwards. 2. Once the search result is found I need to delete all the column data from that result up to row 2 of the column. Can anyone help? I've been messing around with this for a few weeks now and cannot figure it out - sorry! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search from bottom of column up column and delete to top
Start at the top of the column and look for the previous value.
dim FoundCell as range with worksheets("somesheet") with .range("e:e") 'for example Set foundcell = .Cells.Find(What:="whatareyoulookingfor", _ After:=.Cells(1), _ LookIn:=xlValues, _ LookAt:=xlWhole, _ SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False) end with if foundcell is nothing then 'not found, what should happen else if foundcell.row < 2 then msgbox "not found below 1--what should happen here" else .rows(2 & ":" & foundcell.row).delete end if end if end with Jools wrote: New to Excel VBA, trying to find out: 1. How to search (or find) from the bottom of a column upwards. 2. Once the search result is found I need to delete all the column data from that result up to row 2 of the column. Can anyone help? I've been messing around with this for a few weeks now and cannot figure it out - sorry! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search for a column based on the column header and then past data from it to another column in another workbook | Excel Programming | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Programming | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) | |||
Search Column - Find Multiple Entries - Sum Then Delete to Single Entry | Excel Programming | |||
dislike jump bottom of column by double-clicking the bottom of cel | Excel Discussion (Misc queries) |