LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default Search a sheet for a date then delete the row, repeat until the lastrow of the table.

Hi,hope I can explain this right, if someone is able to help please.

I have a table of data, column B has some text in it, column H has
dates.

I want to go down the table for each row, to the last row (which may
vary in address) and check if a date in each row is over a month from
todays date, and if so delete the that row then move to the next.

I have a <TAGR field which will always be after the last row if
genuine data, so I figured if I find this I could set the lastrow
number, but not sure how as I can only return the address. Can I use
Left or something on this value to get the number?

Cells.Find(What:="<TAGR", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
lastrow = ActiveCell.Address(False, False)

So one I have worked out how to do this I figure if I go down column B
to check it isn't <TAGR and if it isnt use ActiveCell.Offset to then
go to column H for that row and check the date. Again not sure how to
do this, I have attempted the logic, but as previously posted I don't
know about coding!

Range("B6").Select

mynow = Now()
mydate = Format(mynow, "dd/mm/yyyy")

For A = 1 To lastrow
If ActiveCell.Value = "<TAGR" Then
Set A = lastrow
Next A
Else
ActiveCell.Offset(0, 6).Activate
'what do i put here?
Else: Selection.EntireRow.Delete
Next A

Cheers

Rich
 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeat keystrokes to delete character in column Graeme at Raptup Excel Worksheet Functions 5 October 4th 07 05:57 PM
Search for repeat words in Excel database Jackpine Excel Discussion (Misc queries) 5 January 9th 07 11:31 PM
need macro script - repeat to delete 2 rows BB Excel Discussion (Misc queries) 3 November 14th 06 12:00 AM
Match, Copy, Merge, Delete and Repeat... MVP's this one's for you. dannyfromnj Excel Discussion (Misc queries) 1 June 19th 06 10:14 PM
Quick Macro question - How to delete two rows then skip one - and repeat David Smithz Excel Discussion (Misc queries) 3 March 3rd 06 02:58 PM


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

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

About Us

"It's about Microsoft Excel"