Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need to know how to do if the columns and rows are different between the sheets. For instance sheet 1 date at A1 and need to have copy on sheet 2 at D8, and then sheet 2s D8 back to sheet 1s A1 and I am needing to do this to more than just 1 cell needing multiple cell like this. This is what was given to me and it works really well but is not exactly what i need.
Sub Worksheet_SelectionChange(ByVal Target As Range)
Set myRange = Range("A1,B3,C5")
If Not Intersect(Target, myRange) Is Nothing Then
myDate = Application.InputBox("Enter A Date", "Date Entry")
Sheets(1).Range(Target.Address) = myDate
Sheets(2).Range(Target.Address) = myDate
End If
End Sub

yes, I really appreciate the help and sorry not used to this forum. but would appreciate any more help you could give and again thanks in advance.

Unless there is some pattern that is associated with the cell pairings in question, such as the same number of rows and columns offset from the cells in one sheet to the cells in the other, you would need to hard code each individual pairing.
In Sheet1 you might put something like this:
Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$A$1" Then myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(1).Range(Target.Address) = myDate Sheets(2).Range("$D$8") = myDate End If If Target.Address = "$B$5" Then myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(1).Range(Target.Address) = myDate Sheets(2).Range("$F$3") = myDate End If If Target.Address = "$C$2" Then myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(1).Range(Target.Address) = myDate Sheets(2).Range("$B$4") = myDate End If End SubIn Sheet2, you would reverse each pairing. e.g.
If Target.Address = "$D$8" Then myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(2).Range(Target.Address) = myDate Sheets(1).Range("$A$1") = myDate End IfAnother option, which actually might be more efficient, is to use Select Case. Again, you would need a copy of this code in both sheets, with the pairings reversed.
Sub Worksheet_SelectionChange(ByVal Target As Range) Select Case Target.Address Case "$A$1" myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(1).Range(Target.Address) = myDate Sheets(2).Range("$D$8") = myDate Case "$B$5" myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(1).Range(Target.Address) = myDate Sheets(2).Range("$F$3") = myDate Case "$C$2" myDate = Application.InputBox("Enter A Date", "Date Entry") Sheets(1).Range(Target.Address) = myDate Sheets(2).Range("$B$4") = myDate End Select End Sub

![]() |
Panasonic Kx-p1180
|
need a macro or vba code ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |