Get address of found range to use in a formula


K

keri

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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top