R
Richhall
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
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