View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Colin Hayes Colin Hayes is offline
external usenet poster
 
Posts: 465
Default Complex formula help , please.

In article , Claus Busch
writes
Hi Colin,

Am Mon, 30 Apr 2012 20:44:21 +0100 schrieb Colin Hayes:

E2 on sheet one is not empty and does have content.


copy the code into the code modul of sheet1:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address < "$A$2" Then Exit Sub

With Sheets("Sheet2")
If Target = .[B2] And (.[H2] = 3 Or .[H2] .[J2]) Then
[E2] = .[J2]
End If
End With
End Sub

If you change A2 in Sheet1 and the conditions are true, the code
changes E2.


Regards
Claus Busch



Hi Claus

OK That's excellent - thank you very much indeed. It does the job
exactly for the target line.

I'll need to try to adapt it so I can use as a formula in a more
traditional macro that I can run though.

This is because it needs to apply itself to all the rows in the sheet ,
one by one. Also the number in B2 will need to match against column A.
This is because it may be in future checks , the order may vary.
(Sorry!).

Perhaps helper columns for column E and some copying and some
pasting-back could be employed.

So if a match for B2 is found in column A then the relevant changes
would be made in that row. The macro would then check the number in B3
against all in column A and so on to the bottom of the sheet. Mind
Boggling!