![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 5
|
Many thanks to Nimrod for this code. Works like a champ.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) ' mirror values between colA & colB If Target.Column = 1 Then Cells(Target.Row, 2).Value = Target If Target.Column = 2 Then Cells(Target.Row, 1).Value = Target End Sub Now I want to take it a step further, to be able to specify which two cells to mirror. I'm not having much success. Any ideas would be greatly appreciated. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Millbank, London, UK
Posts: 1,790
|
http://www.mrexcel.com/board/viewtop...c=7923&forum=2
http://www.mrexcel.com/board/viewtop...c=7858&forum=2 there's no need to start seperate threads for a related question this is now the third stick to your original thread if possible |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Hi Philly
Just change the numbers in the code if you want to change the two rows to evaluate. for example if you want it to be rows 3 and 6 Then: Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) ' mirror values between colA & colB If Target.Column = 3 Then Cells(Target.Row, 6).Value = Target If Target.Column = 6 Then Cells(Target.Row, 3).Value = Target End Sub |
|
|
|
|
|
#4 |
|
New Member
Join Date: May 2002
Posts: 5
|
Hi Nimrod
Thanks again for your help. I guess I didn't ask the follow up the right way. What I'm trying to do is to mirror two specific cells, not two entire rows or columns. Example, mirror cells D22 and J13. Thanks! |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Here's a fun little deviation
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
' mirror values between Odd & Even Cols
If (Target.Column Mod 2) = 0 Then
Cells(Target.Row, Target.Column - 1).Value = Target
Else
Cells(Target.Row, Target.Column + 1).Value = Target
End If
End Sub
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Mirror D22 and J13
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
' mirror values between D22 and J13
If (Target.Column = 4) And (Target.Row = 22) Then Cells(13, 10).Value = Target
If (Target.Column = 10) And (Target.Row = 13) Then Cells(22, 4).Value = Target
End Sub
|
|
|
|
|
|
#7 |
|
New Member
Join Date: May 2002
Posts: 5
|
Hi Nimrod,
You're the man! Works great. I like the even odd variant too! LOL Thanks!!! |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
Cheers Philly ... it's been fun
__________________
<MARQUEE>...........Never be afraid to try something new. Remember, amateurs built the ark, professionals built the Titanic...............The easiest thing to find is fault, don't be easy !.. --Anonymous--...</marquee> |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|