VLookup not working in VBA

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
7,975
Office Version
2007
Platform
Windows
Did you read post #7 ? with a single line you can find the value.

Do you want all the A-B, A-C, A-D, B-C, B-D and C-D combinations, or only the A-B and C-D combinations?

You want the result of all the combinations in an arrangement or better yet, in Excel cells. Or you just want a result.
Why not better raise everything you have, what you want to do and what you want as a result.
The above is because you started with a simple search that was solved because you were not correctly declaring a variable, but now we are going in a loop of combinations, but you still do not ask what your final objective is.
 

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
956
Your problem is you defined myarray as type long, msgbox only types out strings, so the assignment to myarray is perfectly ok ( I think) I think the problem is just with your method of looking at it.
try this:

Code:
dim tt as string


tt = cstr(myarray(X,y)
MsgBox ("This is my array value: " & tt)
or faster try looking at myarray on the locals window.
 
Last edited:

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
956
I finally got back to my computer and solved your problem you need to change the declaration of myarray
to:
Code:
Dim MyArray(1 To 5, 1 To 5) As Variant
 

Forum statistics

Threads
1,078,520
Messages
5,340,922
Members
399,399
Latest member
SravanaSandhya

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top