Hi,
I wonder if I could get some help on this one please?
I am using the code below to allow 2 way entry between cells on two sheets in the same workbook, named SUMMARY and SET UP - e.g. the code allows entry in SUMMARY cell D97 to update SET UP cell H507 and vice versa. The code works well but I need to enter it over 300 times to achieve what I need. Is there a way I can code this more efficiently?
The linked cells come in blocks - e.g. SUMMARY cells D97,D98,D99,D100,D101,D102,D103 need to allow 2 way entry with SET UP cells H507,H510,H513,H516,H519,H522,H525
then the second block would be SUMMARY cells D197, D198, D199 having 2 way entry with SET UP cells H607,H610, H613.....
3rd block adds another 100 to the cell references on both sheets and so on. Hope I've explained it clearly enough
Code in the SUMMARY sheet
and CODE in the SET UP sheet
Any help or thoughts would be much appreciated.
Thank you,
Iain
I wonder if I could get some help on this one please?
I am using the code below to allow 2 way entry between cells on two sheets in the same workbook, named SUMMARY and SET UP - e.g. the code allows entry in SUMMARY cell D97 to update SET UP cell H507 and vice versa. The code works well but I need to enter it over 300 times to achieve what I need. Is there a way I can code this more efficiently?
The linked cells come in blocks - e.g. SUMMARY cells D97,D98,D99,D100,D101,D102,D103 need to allow 2 way entry with SET UP cells H507,H510,H513,H516,H519,H522,H525
then the second block would be SUMMARY cells D197, D198, D199 having 2 way entry with SET UP cells H607,H610, H613.....
3rd block adds another 100 to the cell references on both sheets and so on. Hope I've explained it clearly enough
Code in the SUMMARY sheet
VBA Code:
If Not Intersect(Target, Range("D97")) Is Nothing Then
If Target = Range("D97") Then
If Sheets("SET UP").Range("H507").Value <> Target.Value Then
Sheets("SET UP").Range("H507").Value = Target.Value
End If
End If
End If
If Not Intersect(Target, Range("D98")) Is Nothing Then
If Target = Range("D98") Then
If Sheets("SET UP").Range("H510").Value <> Target.Value Then
Sheets("SET UP").Range("H510").Value = Target.Value
End If
End If
End If
and CODE in the SET UP sheet
VBA Code:
If Not Intersect(Target, Range("H507")) Is Nothing Then
If Target = Range("H507") Then
Sheets("SUMMARY").Range("D97").Value = Target.Value
End If
End If
If Not Intersect(Target, Range("H510")) Is Nothing Then
If Target = Range("H510") Then
Sheets("SUMMARY").Range("D98").Value = Target.Value
End If
End If
Any help or thoughts would be much appreciated.
Thank you,
Iain