Re: Convert Excel Formula to VBA
- From: "Tom Ogilvy" <twogilvy@xxxxxxx>
- Date: Sat, 31 Dec 2005 13:57:54 -0500
Sub AC()
Dim vD6 As Variant, rng As Range, rng1 As Range
vD6 = Worksheets("P1").Range("D6").Value
Set rng = Worksheets("Summary").Range("D2:D90")
res = Application.Match(vD6, rng, 0)
If Not IsError(res) Then
Set rng1 = rng(res, 2)
application.Goto rng1, True
Else
MsgBox "Not found"
End If
End Sub
Obviously adjust the assignment of the variable vD6 to whatever you need.
--
Regards,
Tom Ogilvy
"John V" <jmvenabl@xxxxxxxxxxx> wrote in message
news:D7418480-2D88-44F9-AC18-47FEA59D069F@xxxxxxxxxxxxxxxx
> Dear experts,
>
> My active *** is P1, from which I have found an id value. I now wish to
> 'get' a value (let's call it maxpt) which is on another *** (Summary).
If I
> were doing this in an Excel formula, the cell would contain the following:
>
>
=IF(ISNA(MATCH(D6,Summary!D2:D90,0)),"",OFFSET(Summary!D2,MATCH(D6,Summary!D
2:D90,0)-1,1))
>
> where D6 is the id value and the result would be maxpt. How, if at all,
does
> this convert to VBA? And can I use a VBA variable in place of the 'D6'?
>
> Thanks!
.
- Prev by Date: paste to word document and save
- Next by Date: Re: how to create a new folder through a macro ??
- Previous by thread: paste to word document and save
- Next by thread: Identifying Visible Toolbars
- Index(es):