Message 1 of 1
VBA excel on date form Inventor... Vlookup keep fail.. Why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this code in Excel VBA
Dim rownr
Dim TotalUnit As Integer
Dim Total As Integer
Dim countup As Integer
rownr = 2
Do Until Cells(rownr, 36).Value = ""
TotalUnit = 0
Total = 0
'main item for this count
TotalUnit = (Len(Cells(rownr, 36)) - 1)
Total = Cells(rownr, 37)
Cells(rownr, 38).Value = Total
' add secondar unit
currentItem = 1
Do Until TotalUnit = 0
If Right(left((Cells(rownr, 36).Value), (TotalUnit + 1)), 1) = "." Then
Multiunit = 0
Multiunit = Application.WorksheetFunction.VLookup(left(Cells(rownr, 36).Value, TotalUnit), Range("A:AL"), 37, False)
If Multiunit = 0 Then
Multiunit = 1
End If
Total = Total * Multiunit
Else
End If '
TotalUnit = TotalUnit - 1
Loop
Cells(rownr, 38).Value = Total
rownr = rownr + 1
Loop
End Sub
The Code give me this
But I was surpose to get this
it seems that the Vloopup fail for some reason ... the thing is that the same code have work in a Test excel.. back then it seems that it wanted to have AJ as String in formating in excel and AK as number to work ... one other problem it have that the code need to be under the Sheet... and not the workbook folder ... I have done both as far as I know is the final doc.. that I try to creat.. .. but it seems to not work no matter what I do. Any idear why and how to fix it?