![]() |
moving to relative location after finding data
Hi
try Dim rng as range Dim del_rng as range 'code to find the cell and assign this cell to rng .... set del_rng = Range(rng.offset(-1,1),cells(1,rng.column+1)) del_rng.clearcontents -- Regards Frank Kabel Frankfurt, Germany "Jim K" schrieb im Newsbeitrag ... I need to find a string in a worksheet "xxx_virtual" and then move up one row and right one cell and delete everything from there to the top of the worksheet. I can build the macro using the record function, but the only problem is that the macro uses the cell name when I move to that location and the data changes each day- so my macro has to be rebuilt each day. How can I replace the cell range with a relative cell address? Thanks. Jim |
moving to relative location after finding data
I've been using the record macro from within excel, so the code below is what is generated and the Range("").select is the cell that is one row above and one column to the right fo the cell that contains "phbs_virtual" It's the d27976 that changes each day. Cells.Find(What:="phbs_virtual", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range("D27976").Select Range(Selection, Cells(1)).Select Selection.EntireRow.Delete Range("A1").Select *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 04:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com