PC Review


Reply
Thread Tools Rate Thread

Address of a Cell

 
 
Mallick
Guest
Posts: n/a
 
      4th May 2009
Hi Every One

I am relatively new to programming and have benefited greatly from this
forum. I have got another very basic issue which I am unable to address
myself.

I am comparing the smallest value from an array which is stored in variable
"Least" and then, look for the corresponding value in another array with the
following code:

Least = Application.WorksheetFunction.Small(Array, 1)


A = Application.WorksheetFunction.HLookup(Least, Range, 6, False)

I would also like to obtain the cell addresses of the two (The smallest of
"Array" and its correspodning value in "Range".

Kindly help.

Many Thanks

Mallick
 
Reply With Quote
 
 
 
 
Stefi
Guest
Posts: n/a
 
      4th May 2009
Try this:
(In my example I replaced "Array" with Range("A1:B6"),
"Range" with Range("C1:G6"))

Least = WorksheetFunction.Small(Range("A1:B6"), 1)
Range("A1:B6").Select
LAddr = Selection.Find(What:=Least, After:=ActiveCell, LookIn:=xlValues,
LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Address
A = Application.WorksheetFunction.HLookup(Least, Range("C1:G6"), 6, False)
Range("C1:G6").Select
AAddr = Selection.Find(What:=A, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Address

Regards,
Stefi

„Mallick” ezt *rta:

> Hi Every One
>
> I am relatively new to programming and have benefited greatly from this
> forum. I have got another very basic issue which I am unable to address
> myself.
>
> I am comparing the smallest value from an array which is stored in variable
> "Least" and then, look for the corresponding value in another array with the
> following code:
>
> Least = Application.WorksheetFunction.Small(Array, 1)
>
>
> A = Application.WorksheetFunction.HLookup(Least, Range, 6, False)
>
> I would also like to obtain the cell addresses of the two (The smallest of
> "Array" and its correspodning value in "Range".
>
> Kindly help.
>
> Many Thanks
>
> Mallick

 
Reply With Quote
 
Mallick
Guest
Posts: n/a
 
      4th May 2009

Thanks Steffi for your quick reply.

Its not as simple as I expected it to be. As I mentioned earlier that I am a
bit of novice in VBA, can you please explain your code?

Thanks

Mallick
"Stefi" wrote:

> Try this:
> (In my example I replaced "Array" with Range("A1:B6"),
> "Range" with Range("C1:G6"))
>
> Least = WorksheetFunction.Small(Range("A1:B6"), 1)
> Range("A1:B6").Select
> LAddr = Selection.Find(What:=Least, After:=ActiveCell, LookIn:=xlValues,
> LookAt _
> :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:= _
> False, SearchFormat:=False).Address
> A = Application.WorksheetFunction.HLookup(Least, Range("C1:G6"), 6, False)
> Range("C1:G6").Select
> AAddr = Selection.Find(What:=A, After:=ActiveCell, LookIn:=xlValues, LookAt _
> :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:= _
> False, SearchFormat:=False).Address
>
> Regards,
> Stefi
>
> „Mallick” ezt *rta:
>
> > Hi Every One
> >
> > I am relatively new to programming and have benefited greatly from this
> > forum. I have got another very basic issue which I am unable to address
> > myself.
> >
> > I am comparing the smallest value from an array which is stored in variable
> > "Least" and then, look for the corresponding value in another array with the
> > following code:
> >
> > Least = Application.WorksheetFunction.Small(Array, 1)
> >
> >
> > A = Application.WorksheetFunction.HLookup(Least, Range, 6, False)
> >
> > I would also like to obtain the cell addresses of the two (The smallest of
> > "Array" and its correspodning value in "Range".
> >
> > Kindly help.
> >
> > Many Thanks
> >
> > Mallick

 
Reply With Quote
 
Mallick
Guest
Posts: n/a
 
      4th May 2009
Stefi

It was unable to differentiate between integer and double. Forexample, Least
value was 1 and when searched through the Array, it gave the address of the
cell with 1.6 value.

Kindly help to remove this bug. Thanks

Mallick



"Mallick" wrote:

>
> Thanks Steffi for your quick reply.
>
> Its not as simple as I expected it to be. As I mentioned earlier that I am a
> bit of novice in VBA, can you please explain your code?
>
> Thanks
>
> Mallick
> "Stefi" wrote:
>
> > Try this:
> > (In my example I replaced "Array" with Range("A1:B6"),
> > "Range" with Range("C1:G6"))
> >
> > Least = WorksheetFunction.Small(Range("A1:B6"), 1)
> > Range("A1:B6").Select
> > LAddr = Selection.Find(What:=Least, After:=ActiveCell, LookIn:=xlValues,
> > LookAt _
> > :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > MatchCase:= _
> > False, SearchFormat:=False).Address
> > A = Application.WorksheetFunction.HLookup(Least, Range("C1:G6"), 6, False)
> > Range("C1:G6").Select
> > AAddr = Selection.Find(What:=A, After:=ActiveCell, LookIn:=xlValues, LookAt _
> > :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> > MatchCase:= _
> > False, SearchFormat:=False).Address
> >
> > Regards,
> > Stefi
> >
> > „Mallick” ezt *rta:
> >
> > > Hi Every One
> > >
> > > I am relatively new to programming and have benefited greatly from this
> > > forum. I have got another very basic issue which I am unable to address
> > > myself.
> > >
> > > I am comparing the smallest value from an array which is stored in variable
> > > "Least" and then, look for the corresponding value in another array with the
> > > following code:
> > >
> > > Least = Application.WorksheetFunction.Small(Array, 1)
> > >
> > >
> > > A = Application.WorksheetFunction.HLookup(Least, Range, 6, False)
> > >
> > > I would also like to obtain the cell addresses of the two (The smallest of
> > > "Array" and its correspodning value in "Range".
> > >
> > > Kindly help.
> > >
> > > Many Thanks
> > >
> > > Mallick

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return cell address of a cell based on contents of cell. Danny Microsoft Excel Worksheet Functions 4 15th Nov 2008 03:11 AM
Excel - cell address inside formula as text from other cell kris.krzysiek@gmail.com Microsoft Excel Discussion 5 30th Jan 2008 12:58 AM
find last cell in range with data, display cell address =?Utf-8?B?c2V2aTYx?= Microsoft Excel Worksheet Functions 14 29th Oct 2007 08:36 PM
How make hyperlink refer to cell content rather than cell address. =?Utf-8?B?T211bmVuZQ==?= Microsoft Excel Misc 3 2nd Mar 2006 01:07 AM
store cell contents and cell address for comparsion & suming =?Utf-8?B?SmltIFdoZWxjaGVs?= Microsoft Excel Programming 1 24th Nov 2004 04:03 PM


Features
 

Advertising
 

Newsgroups
 


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