Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello from Steved
The Below formula is in Cell B6 Question is it possible to have this in visual basic, the reason I ask is that I cut a paste and need to retype the formula each time, i do the pasting. =IF(ISNA(VLOOKUP(--A6,'All Bus Models'!$A$5:$E$5000,4,FALSE)),"Out Of Service",VLOOKUP(--A6,'All Bus Models'!$A$5:$E$5000,4,FALSE)) Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Steved,
It quite an easy function: ' lookup is the value to lookup call it ' =busmodel("Routemaster R2RH") Public Function BusModel(lookup) as String Const wsn As String = "All Bus Models" Const r As String = "$A$5:$E$5000" On Error GoTo error_line BusModel = WorksheetFunction.VLookup(lookup, _ Worksheets(wsn).Range(r), 4, False) Exit Function error_line: BusModel = "Out Of Service " End Function you can change it to supply addresses in the call to the function rather than hard code them in the function. -- Hope this helps Martin Fishlock "Steved" wrote: Hello from Steved The Below formula is in Cell B6 Question is it possible to have this in visual basic, the reason I ask is that I cut a paste and need to retype the formula each time, i do the pasting. =IF(ISNA(VLOOKUP(--A6,'All Bus Models'!$A$5:$E$5000,4,FALSE)),"Out Of Service",VLOOKUP(--A6,'All Bus Models'!$A$5:$E$5000,4,FALSE)) Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks very much Martin.
"Martin Fishlock" wrote: Steved, It quite an easy function: ' lookup is the value to lookup call it ' =busmodel("Routemaster R2RH") Public Function BusModel(lookup) as String Const wsn As String = "All Bus Models" Const r As String = "$A$5:$E$5000" On Error GoTo error_line BusModel = WorksheetFunction.VLookup(lookup, _ Worksheets(wsn).Range(r), 4, False) Exit Function error_line: BusModel = "Out Of Service " End Function you can change it to supply addresses in the call to the function rather than hard code them in the function. -- Hope this helps Martin Fishlock "Steved" wrote: Hello from Steved The Below formula is in Cell B6 Question is it possible to have this in visual basic, the reason I ask is that I cut a paste and need to retype the formula each time, i do the pasting. =IF(ISNA(VLOOKUP(--A6,'All Bus Models'!$A$5:$E$5000,4,FALSE)),"Out Of Service",VLOOKUP(--A6,'All Bus Models'!$A$5:$E$5000,4,FALSE)) Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Regression Leverage Formula (Jerry W. Lewis or Mike Middleton)already have DFITS formula | Excel Worksheet Functions | |||
Excel 2002 Formula: Urgent Conditional Formula Required Right Away - if possible | Excel Discussion (Misc queries) | |||
Formula expected end of statement error, typing formula into cell as part of VBA macro | Excel Programming | |||
Excel 2002 formula displayed not value formula option not checked | Excel Worksheet Functions | |||
Commenting custom formula fields/formula on formula editor | Excel Programming |