LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default vba problem with lookup

Everything is working fine in this code until after strTemp1 =Left(strTemp1,1),
which = "5"

The Worksheets("Tables").Range("TranslationTable") is a valid table. I
checked by going to FormulaName manager and checking to see if it was
correct.
But I get a runtime error 1004:
Unable to get the VLookup property of the WorksheetFunction class

I also made sure the cells in the TransactionTable range were set as text so
that a 5 in the cell should be the same as a 5 returned by strTemp1 but that
didn't help either

In the code below I hardcoded the table range to see if that worked but it
did not.

Any suggestions?
Sub TranslateSyntax()

Dim strOne As String, strTwo As String
Dim strFound1 As String, strFound2 As String, strFound3 As String, strFound4
As String
Dim strPart1 As String, strPart2 As String, strPart3 As String, strPart4 As
String
Dim iStrtCol As Integer, iStrtRow As Integer, iEndRow As Integer
Dim EndCol As Integer, NewEndCol As Integer
Dim strTemp1 As String
Dim tabRange As Range

iStrtRow = Cells.Find(What:="when", MatchCase:=True).Row
iStrtCol = Cells.Find(What:="when", MatchCase:=True).Column
iEndRow = Cells(iStrtRow, iStrtCol).End(xlDown).Row

strFound1 = LTrim(Cells(iStrtRow + 1, iStrtCol).Value)
strFound2 = LTrim(Cells(iStrtRow + 3, iStrtCol).Value)
strFound3 = LTrim(Cells(iStrtRow + 5, iStrtCol).Value)

' find the last show day ie 5d = 5 days later
iStrtRow = Cells.Find(What:="show", MatchCase:=True).Row
iStrtCol = Cells.Find(What:="show", MatchCase:=True).Column
For i = iStrtRow To Cells.Find(What:="when", MatchCase:=True).Row - 1

If Cells([i], iStrtCol).Value = "" Then
Exit For
Else
strTemp1 = Trim(Cells([i], iStrtCol).Value)
strTemp1 = Left(strTemp1, 2)
End If
Next i
strTemp1 = Left(strTemp1, 1)
Set tabRange = Worksheets("Tables").Range("e1:f20")
strTemp1 = WorksheetFunction.VLookup(strTemp1, tabRange, 2, False)


End Sub

 
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
LOOKUP problem Lisa Cowan Excel Worksheet Functions 8 January 27th 10 04:51 PM
Lookup problem murrmeik Excel Worksheet Functions 2 May 13th 08 07:33 PM
lookup problem Rich Excel Programming 2 August 28th 06 07:18 AM
lookup problem rich Excel Worksheet Functions 2 January 27th 06 10:37 AM
Lookup Problem StephanieH Excel Worksheet Functions 1 December 20th 04 06:17 PM


All times are GMT +1. The time now is 03:19 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"