View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ChristopherTri ChristopherTri is offline
external usenet poster
 
Posts: 49
Default A few questions - newbie in VBA

I hope I followed your logic... I think you can do this without using VBA.

In the solution below, the three worksheets are named "Sheet1", "Sheet2",
and "Sheet3"

On row 2 of Sheet 2, use the following formula:

=IF(A1=Sheet1!A1,Sheet1!A2,"")

On row 2 of Sheet3, use the following formula:

=IF(COUNTIF(Sheet2!$A$2:$E$2,"")=0,Sheet2!A2,"")

Fill across the range you are using on row 2 of both sheets.

Using this logic, Sheet3 will only have data in row 2 when all cells in row
1 of Sheet1 match cells in row 1 of Sheet2.

Regards...

p.s. Your typing in English is much better than mine would be in Dutch.



"Cheetahke" wrote:

Hello everyone,

If I does not use the right words in English, please forgive me, I'm used to
type in Dutch...

I have 3 worksheets to work with.
In the first worksheet, I have a cell with a date (today) and a cell with a
time (today's time). This time changes every minute.
I also have a range of 7 columns and about 12 rows. In this range are only
the cells of the 2nd row filled with values that does not change. All the
other cells are filled with a formula for getting the values out of an other
program.

In the second worksheet, I have a range of 14 columns and about 12 rows.
In this range, the cells of the first row will be filled with values by
someone. The other cells are empty.

What I like to realise is the following:

1) When someone opens the workbook, and fills the first row of worksheet 2,
that automaticly the value of this cells will be compared with the values of
the first row on worksheet 1. If the value matches, the value of the second
row on worksheet 1 (same column) need to be copied into the cell beneath the
matching value on worksheet 2. If there's no match, that cell remain empty.

2) If a cell on worksheet 1, in the first row is changed (this changes
automaticly), then that value must be compared with the values on worksheet 2
in row 1. If that value exists, the value of the cell beneath (on worksheet
1) must be copied into the cell beneath the matching value.
If all the cells on worksheet 2, 2nd row are filled with values, then the
values need to be copied to worksheet 3. Worksheet 3 is an exact copy of
worksheet 2.

I hope someone can help me solving this.
If I have to use VBA-code, please tell me where I have to put this code in
(in "Worksheet" or "this workbook") or do I have to make a module?