unpronounciable
New Member
- Joined
- Feb 27, 2011
- Messages
- 6
When a value in a cell changes, other cells (which rows are specified in the target row) will change too.
I admit, the question is confusing, so I give the example.
<TBODY>
</TBODY>
Values in cells B1 and B3 are manually entered. Basically what I want is whatever values that I entered in A1 will be duplicated in row 3 (as specified in B1). Vice versa, whatever value that I entered in A3 will be duplicated in row 1 (as specified in B3).
Using this macro, I'm able to get the result.
So if I ticked A1, cell A3 will be ticked as well.
<TBODY>
</TBODY>
However, I need loops for multiple duplications, and I have no idea how.
<TBODY>
</TBODY>
I want if I tick A1, cells A3, A5 and A6 (rows 3, 5 and 6 as specified in B1) will be ticked as well.
And thank you in advance for your interest and valuable input!
I admit, the question is confusing, so I give the example.
A | B | |
1 | 3 | |
2 | ||
3 | 1 | |
4 |
<TBODY>
</TBODY>
Values in cells B1 and B3 are manually entered. Basically what I want is whatever values that I entered in A1 will be duplicated in row 3 (as specified in B1). Vice versa, whatever value that I entered in A3 will be duplicated in row 1 (as specified in B3).
Using this macro, I'm able to get the result.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Cancel = True 'Prevent going into Edit Mode
If Target = vbNullString Then
Target = ChrW(&H2713)
If Target.Offset(0, 1).Value <> vbNullString Then Cells(Target.Offset(0, 2).Value, 10) = ChrW(&H2713)
Else
Target.ClearContents
If Target.Offset(0, 1).Value <> vbNullString Then Cells(Target.Offset(0, 2).Value, 10) = vbNullString
End If
End If
End Sub
So if I ticked A1, cell A3 will be ticked as well.
A | B | |
1 | ✓ | 3 |
2 | ||
3 | ✓ | 1 |
4 |
<TBODY>
</TBODY>
However, I need loops for multiple duplications, and I have no idea how.
A | B | |
1 | 3|5|6 | |
2 | ||
3 | 1|5|6 | |
4 | ||
5 | ||
6 | 1|3|5 |
<TBODY>
</TBODY>
And thank you in advance for your interest and valuable input!