Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MACRO, help for making
Hi!
I will tell you concrete problem, which I have. There, in the first sheet, I have a matrix with some numbers. In the second sheet I have two columns with some values. I need that for the number from matrix (from sheet 1) find the same number in the first column (from sheet 2) and take value from the second column, same row (from sheet 2, too). I tried to solve this problem, but no so successful! Thanks in advance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MACRO, help for making
You have not specified what you want to do with the number in the second
column of the second sheet once it/they are found. Anway, here is a small example - assumptions: a 4 by 4 matrix starting in cell A1 on sheet 1. A column of 20 number on sheet 2 in columns A and B: option base 1 dim x as integer dim y as integer dim intCounter as integer dim array(16) as long '(change the variable type depending on your need dim array2() as long '(again depending on the type of data in column B sheet 2) intCounter=1 'store all values in the matrix for x=1 to 4 for y=1 to 4 array(intCounter)=cells(x,y).value intCounter=intCounter+1 next y next x 'evaluate second sheet for matches sheets("Sheet2").select intCounter=1 for x=1 to 20 for y=1 to 20 if array(x).value=cells(y,1).value then redim preserve array2(intCounter) array2(intCounter)=cells(y,2).value end if next y next x Let me know if it works. I have just written this without excel in front of me. "Marija" wrote in message ... Hi! I will tell you concrete problem, which I have. There, in the first sheet, I have a matrix with some numbers. In the second sheet I have two columns with some values. I need that for the number from matrix (from sheet 1) find the same number in the first column (from sheet 2) and take value from the second column, same row (from sheet 2, too). I tried to solve this problem, but no so successful! Thanks in advance! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MACRO, help for making
Marija,
VLOOKUP([reference cell from your matrix], [Cell range from sheet 2 that has your 2 columns af data], [Column number to return data from, in your case I assume it will be 2], False) Llama |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
MACRO, help for making
Thank You llama. I have solved my problem by using your suport.
€žllama€ś je napisao: Marija, VLOOKUP([reference cell from your matrix], [Cell range from sheet 2 that has your 2 columns af data], [Column number to return data from, in your case I assume it will be 2], False) Llama |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Making macro | Excel Discussion (Misc queries) | |||
Making a macro always available | Excel Discussion (Misc queries) | |||
making chart using macro | Excel Discussion (Misc queries) | |||
making macro run automatically | Excel Programming | |||
making toolbars with a macro | Excel Programming |