Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
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
Making macro George A. Jululian Excel Discussion (Misc queries) 7 July 21st 07 04:09 PM
Making a macro always available simonc Excel Discussion (Misc queries) 1 April 19th 07 09:30 AM
making chart using macro roger Excel Discussion (Misc queries) 0 March 30th 07 04:46 PM
making macro run automatically Paul Excel Programming 1 November 26th 04 10:18 PM
making toolbars with a macro Greg Prost Excel Programming 1 November 21st 03 09:53 AM


All times are GMT +1. The time now is 08:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"