Change value in cell
I have cells
G2 G4 G13 G14 when I change the value in any of these I would like it to change in all 4 ex. If I change G2 to 65 then G4,G13,G14 will be 65 If I change G4, then the rest will change. and so on. I only need these 4 to be the same. I was going to do the =G2, but I can't do that. I don't know which cell they are going to change. They are using this for a cost presentation. I am leting people use this that have no clue about formulas and will get frustrated, if it does not work. Thanks. |
Change value in cell
'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal target As Range) '----------------------------------------------------------------- Const WS_RANGE As String = "G2,G4,G13,G14" Dim sTemp Dim cell As Range On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(target, Me.Range(WS_RANGE)) Is Nothing Then sTemp = target.Value For Each cell In Range(WS_RANGE) cell.Value = sTemp Next cell End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Chey" wrote in message ... I have cells G2 G4 G13 G14 when I change the value in any of these I would like it to change in all 4 ex. If I change G2 to 65 then G4,G13,G14 will be 65 If I change G4, then the rest will change. and so on. I only need these 4 to be the same. I was going to do the =G2, but I can't do that. I don't know which cell they are going to change. They are using this for a cost presentation. I am leting people use this that have no clue about formulas and will get frustrated, if it does not work. Thanks. |
All times are GMT +1. The time now is 11:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com