Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA - VLOOKUP Sub

Hi,
When a user click a button, I want to perform a VLOOKUP.
However, when the user clicks this button, the formula is
entered correctly, apart from '' around column names, i.e.
B9 becomes 'B9' - this stops the formula from functioning
correctly.

How can I stop it doing this? Heres my code..
Sub getDesc(strLookup_value, strTable_array,
intIndex_column)

Range("E8").FormulaR1C1 = _
"=VLOOKUP(" & strLookup_value & "," &
strTable_array & "," & intIndex_column & ")"

End Sub

Sub getDesc_Sys()
Call getDesc("Temp!B9", "HardwareData!A8:Q11", "16")
End Sub
Note: I've made a sub to get the desc, because once the
first one will work, i can do many more but just using one
line of code and calling the first sub with my own values.

Can anyone help?
Thanks.
MJ Anotszkiw
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default VBA - VLOOKUP Sub

MJ

Try using Formula instead of FormulaR1C1.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.


"MJ Antoszkiw" wrote in message
...
Hi,
When a user click a button, I want to perform a VLOOKUP.
However, when the user clicks this button, the formula is
entered correctly, apart from '' around column names, i.e.
B9 becomes 'B9' - this stops the formula from functioning
correctly.

How can I stop it doing this? Heres my code..
Sub getDesc(strLookup_value, strTable_array,
intIndex_column)

Range("E8").FormulaR1C1 = _
"=VLOOKUP(" & strLookup_value & "," &
strTable_array & "," & intIndex_column & ")"

End Sub

Sub getDesc_Sys()
Call getDesc("Temp!B9", "HardwareData!A8:Q11", "16")
End Sub
Note: I've made a sub to get the desc, because once the
first one will work, i can do many more but just using one
line of code and calling the first sub with my own values.

Can anyone help?
Thanks.
MJ Anotszkiw



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
VLookUp - Does the VLookUp return the exact information? Cpviv Excel Worksheet Functions 2 October 28th 08 09:57 AM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 02:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"