Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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!
Reply
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
VBA to autofill from relative location AlexJarvis Excel Worksheet Functions 2 April 30th 10 04:47 PM
How to read value of a cell in a relative location AnatolyV Excel Worksheet Functions 1 July 20th 09 02:39 AM
finding the data location of a list in my xls xlsstudent Excel Discussion (Misc queries) 3 May 24th 07 06:16 PM
finding blank cell and moving specific data into it BeJay Excel Worksheet Functions 1 May 30th 06 07:06 PM
Finding data in a Range / Returning Cell Location Betsy Jones Excel Programming 2 August 8th 03 10:10 PM


All times are GMT +1. The time now is 09:33 AM.

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"