Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Get address of found range to use in a formula

Hi,

I want my VB to find a value, and then put the left 3 characters of
the value into another cell. However all I am achieving is putting the
formula

=left((rngfound.address),3)

into a cell (which obviously causes an error) as I do not know how to
"retrieve" the cell address (eg C4) from the rngFound in my code.

My code;

Set rngToSearch =
ActiveSheet.Range("12:12,15:15,18:18,21:21,24:24") .EntireRow
For Each cel In rngToSearch
Set rngFound = rngToSearch.find("G*KT")
If Not rngFound Is Nothing Then
strFirstAddress = rngFound.Address
Do
Set rngcopyto = rngFound.Offset(2, 4)
rngcopyto.Formula = "=LEFT((RNgFOUND.ADDRESS),3)"
Set rngFound = rngToSearch.FindNext(rngFound)
Loop While Not rngFound Is Nothing And rngFound.Address <
strFirstAddress
End If
Next cel

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Get address of found range to use in a formula

Hi Keri,

Try it this way:

rngcopyto.Formula = "=LEFT(" & RNgFOUND.ADDRESS & ", 3)"


--
Hope that helps.

Vergel Adriano


"keri" wrote:

Hi,

I want my VB to find a value, and then put the left 3 characters of
the value into another cell. However all I am achieving is putting the
formula

=left((rngfound.address),3)

into a cell (which obviously causes an error) as I do not know how to
"retrieve" the cell address (eg C4) from the rngFound in my code.

My code;

Set rngToSearch =
ActiveSheet.Range("12:12,15:15,18:18,21:21,24:24") .EntireRow
For Each cel In rngToSearch
Set rngFound = rngToSearch.find("G*KT")
If Not rngFound Is Nothing Then
strFirstAddress = rngFound.Address
Do
Set rngcopyto = rngFound.Offset(2, 4)
rngcopyto.Formula = "=LEFT((RNgFOUND.ADDRESS),3)"
Set rngFound = rngToSearch.FindNext(rngFound)
Loop While Not rngFound Is Nothing And rngFound.Address <
strFirstAddress
End If
Next cel


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
Using the contents of a ADDRESS formula as the cell range in a for Rose Excel Discussion (Misc queries) 3 March 14th 09 04:27 AM
using the address properties from range objects in a sum formula JEFFWI Excel Discussion (Misc queries) 2 September 11th 07 05:36 AM
How to get the address of the cell found our by vlookup dilettante Excel Programming 3 August 25th 06 01:41 AM
Find text String and select cell address where it is found? JCIrish Excel Programming 5 April 16th 06 02:38 PM
Formula to return ADDRESS of cell in range that meets criteria Christie Excel Worksheet Functions 1 March 4th 05 11:13 PM


All times are GMT +1. The time now is 07:29 PM.

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

About Us

"It's about Microsoft Excel"