I have Excel Workbook in which there are 4 sheet which has two cell name start date and end date, whose values should be same across all 4 sheet, I want that If I change the value in anyone of the sheets the other three sheets automatically update that values. And vice versa.
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- Declare a Range relative to the Active Cell with V
- What's the easiest way to create an Excel tabl
Use the Workbook_SheetChange event to update the same cells on every worksheet if any one of the cells changes.
For example, if each sheet has the named ranges
start_date
andend_date
(where their scope is limited to that sheet only), changes made to anystart_date
orend_date
range on any sheet will update the corresponding range on all the other sheets.If you are referring to the cells by their address and not by a defined name, something like this could work:
This code goes in the
ThisWorkbook
module in the VBA editor.You don't need VBA for this but rather named ranges. Put your cursor in the input cell, say E5, for
start_date
and then click in the named range box (in the upper left corner of the worksheet grid, directly above column A). Typestart_date
overE5
and hitEnter
. Now, cell E5 is namedstart_date
. If you use=start_date
anywhere else in the workbook, it will refer to the current contents of cell E5. If you want to edit the named ranges in any way, go to the ribbon menuFORMULAS -> Name Manager
.If you want to do this with VBA for the sole purpose of learning VBA, I would recommend taking a VBA course instead. Udemy has some good ones that often go on sale for about $10, and I'm sure that there are plenty of free resources elsewhere as well.