Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help on VB Excel

Run-time error '1004' - Unable to get the VLookup property of the
WorksheetFunction class. That's the error that I get from VB.

I have a VB program with a VLookup function.

Dim Numero, valor
Dim extenso
Do While Numero = 0
extenso = Application.VLookup(Numero,
Worksheets("Tabelas").Range("R2:S40"), 2)

NUM DESIGN
0 zero
1 um
2 dois
3 tres
4 quatro
5 cinco
This is the Range in the Worksheet Tabelas.
This code works fine until I merge it with the application.
I need some help

Thanks,
Joao








  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Help on VB Excel

Give this a try. It will be faster than the lookup...

Dim Numero, valor
Dim extenso
Do While Numero = 0
extenso = NumeroToText(Numero)



Public Function NumeroToText(ByVal Numero As Integer) As String
Select Case Numero
Case 0
NumeroToText = "zero"
Case 1
NumeroToText = "um"
Case 2
NumeroToText = "dois"
Case 3
NumeroToText = "tres"
Case 4
NumeroToText = "quatro"
Case 5
NumeroToText = "cinco"
Case Else
NumeroToText = "Error"
End Select

End Function

--
HTH...

Jim Thomlinson


"Joao Vaz" wrote:

Run-time error '1004' - Unable to get the VLookup property of the
WorksheetFunction class. That's the error that I get from VB.

I have a VB program with a VLookup function.

Dim Numero, valor
Dim extenso
Do While Numero = 0
extenso = Application.VLookup(Numero,
Worksheets("Tabelas").Range("R2:S40"), 2)

NUM DESIGN
0 zero
1 um
2 dois
3 tres
4 quatro
5 cinco
This is the Range in the Worksheet Tabelas.
This code works fine until I merge it with the application.
I need some help

Thanks,
Joao








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help on VB Excel

Thank you Jim.
I use the VLookup function because the table is 40 lines long.
And I still don't understand the error.
Any help?

Joao

"Jim Thomlinson" wrote:

Give this a try. It will be faster than the lookup...

Dim Numero, valor
Dim extenso
Do While Numero = 0
extenso = NumeroToText(Numero)



Public Function NumeroToText(ByVal Numero As Integer) As String
Select Case Numero
Case 0
NumeroToText = "zero"
Case 1
NumeroToText = "um"
Case 2
NumeroToText = "dois"
Case 3
NumeroToText = "tres"
Case 4
NumeroToText = "quatro"
Case 5
NumeroToText = "cinco"
Case Else
NumeroToText = "Error"
End Select

End Function

--
HTH...

Jim Thomlinson


"Joao Vaz" wrote:

Run-time error '1004' - Unable to get the VLookup property of the
WorksheetFunction class. That's the error that I get from VB.

I have a VB program with a VLookup function.

Dim Numero, valor
Dim extenso
Do While Numero = 0
extenso = Application.VLookup(Numero,
Worksheets("Tabelas").Range("R2:S40"), 2)

NUM DESIGN
0 zero
1 um
2 dois
3 tres
4 quatro
5 cinco
This is the Range in the Worksheet Tabelas.
This code works fine until I merge it with the application.
I need some help

Thanks,
Joao








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



All times are GMT +1. The time now is 02:07 AM.

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

About Us

"It's about Microsoft Excel"