Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88075

VBA Add-in Vlookup ThisWorkbook.Range

$
0
0

I am attempting to create an add-in with a VLOOKUP from a range on the add-in sheet. This is too long to do with case (3000+ lines) and I don't want to have to have the user store this file.

Function WSort(strng)
Dim DivR, wb1 As Workbook, ws1 As Worksheet


    Set wb1 = ThisWorkbook
    Set ws1 = wb1.Sheets("HEA")
    strng = Left(strng, 5)

    WSort = Application.WorksheetFunction.VLookup(RetStr, ws1.Range("C2:D4000"), 2, False)
End Function

I have tried writing this several ways and I keep running into the issue that I cant reliably reference the HEA Tab. I have tried using Sheet3 and Sheets(4).


Viewing all articles
Browse latest Browse all 88075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>