Crossover from Window - Find / VBLOOKUP

C

Charles L. Snyder

Hi-

I am trying to make a workbook that is quite functional in Windows XP
Excel work on Tiger OSX Excel 2004 - with great difficultly. I got rid
of the ActiveX stuff (I think) - am trying to make a simple lookup work
- ie identify a value in a worksheet and return the value of the next
column to the right in same row...

this works in windows:

Sub RVU_Lookup()
Dim my_cpt as Integer
Dim my_rvu as Integer
my_cpt = InputBox("Enter the CPT Code...")
Sheets("RVU Lookup").Select
Columns("A:A").Select
Range("A7201").Activate
Selection.Find(What:=my_cpt, After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
my_rvu = ActiveCell.FormulaR1C1
Sheets("Operations").Select MsgBox ("The CPT code for " +
my_cpt + " is " + my_rvu)

End Sub

It doesn't work on the Mac

Neither does:

Sub RVU_Lookup()
Dim my_cpt as Integer
Dim my_rvu as Integer
Dim myRange as Range
Sheets("RVU Lookup").Select
my_cpt = InputBox("Enter the CPT Code...")
set myRange = Sheets("RVU Lookup").Range("A2:A7250")
my_rvu = Application.WorksheetFunction.VLookup(my_cpt,myRange,2)
MsgBox ("The CPT code for " + my_cpt + " is " + my_rvu)
End Sub

Thanks in advance

CLS
 
B

Bob Greenblatt

Sub RVU_Lookup()
Dim my_cpt as Integer
Dim my_rvu as Integer
my_cpt = InputBox("Enter the CPT Code...")
Sheets("RVU Lookup").Select
Columns("A:A").Select
Range("A7201").Activate
Selection.Find(What:=my_cpt, After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
my_rvu = ActiveCell.FormulaR1C1
Sheets("Operations").Select MsgBox ("The CPT code for " +
my_cpt + " is " + my_rvu)

End Sub
Charlie, it will work fine on a Mac with the following changes:
Remove the SearchFormat parameter. This is not supported on the Mac. Change
the plus signs (+) in the last statement to ampersands (&). This will then
work on both platforms.

Ampersand is the preferred symbol for concatenation on both platforms.
 

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

Top