Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repeat data on all sheets
My spreadsheet has 5 sheets. I want the contents of cell A1 to
be repeated on all 5 sheets. So, for example, if a user changes A1 to "Claus" on Sheet 4 then the change should update A1 on all sheets. Or, if someone changes A1 to "GS" on Sheet 1, then the change should update all sheets, etc.... I'm interested in all methods possible, whether using VBA code or sheet formulas. (I might have asked a similar question long ago, so I apologize if I repeated.) Happy Halloween all! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repeat data on all sheets
Hi Robert,
Am Sat, 31 Oct 2015 15:42:41 -0700 schrieb Robert Crandal: My spreadsheet has 5 sheets. I want the contents of cell A1 to be repeated on all 5 sheets. select Sheet2 and with pressed Shift button Sheet5. Enter in A1 the formula: =Sheet1!A1 Or right click on sheet tab of Sheet1 = Show Code and paste following code into the code window: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address(0, 0) < "A1" Then Exit Sub Dim i As Long For i = 2 To 5 Sheets(i).Range("A1") = Target Next End Sub Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repeat data on all sheets
Hi Robert,
Am Sat, 31 Oct 2015 15:42:41 -0700 schrieb Robert Crandal: So, for example, if a user changes A1 to "Claus" on Sheet 4 then the change should update A1 on all sheets. Or, if someone changes A1 to "GS" on Sheet 1, then the change should update all sheets, etc.... sorry, I misunderstood your problem. If you want to change A1 for all sheets from each sheet then try the following code in the Workbook_SheetChange event: Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address(0, 0) < "A1" Then Exit Sub Dim i As Long Dim ShN As String Application.EnableEvents = False On Error GoTo CleanUp ShN = Sh.Name For i = 1 To 5 If Sheets(i).Name < ShN Then Sheets(i).Range("A1") = Target.Value End If Next CleanUp: Application.EnableEvents = True End Sub Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repeat data on all sheets
"Claus Busch" wrote:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address(0, 0) < "A1" Then Exit Sub Dim i As Long Dim ShN As String Application.EnableEvents = False On Error GoTo CleanUp ShN = Sh.Name For i = 1 To 5 If Sheets(i).Name < ShN Then Sheets(i).Range("A1") = Target.Value End If Next CleanUp: Application.EnableEvents = True End Sub Thanks Claus. That's what I'm looking for. Can the above solution also be implemented with just cell formulas? Just curious. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repeat data on all sheets
Hi Robert,
Am Sun, 1 Nov 2015 02:50:20 -0700 schrieb Robert Crandal: Can the above solution also be implemented with just cell formulas? no, because you can have either formulas OR values in a cell but not both. Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Repeat column in all sheets | Excel Discussion (Misc queries) | |||
how to repeat text on sheets in excel | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Programming | |||
Header repeat across Sheets? | Excel Discussion (Misc queries) |