Automatically updating Master sheet if other sheets are updated?

afc171

Board Regular
Joined
Jan 14, 2017
Messages
143
Office Version
  1. 2013
Platform
  1. Windows
Hi guys,
I have a spreadsheet with a "Master" sheet which has all information listed from all the other sheets. At the moment I have used = to add data from other sheets into the Master one.
Now someone might add or remove a line from any of the sheets which you then have to manually re-do the master sheet.
Is there a different method to update the master file automatically if any data is changed in other sheets? each sheet has the same headers in cells A:I

Thank you
 
Yes, that is working now thanks.
I removed 2 items from StockRoom, ran the sub again but it only updated the Product (A) column.
If StockRoom sheets gets updated is it easier to just clear CopyData and run Sub FindingLastRow again? Also if there are more StockRoom sheets how would I add these to the last empty row in CopyData?
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You may as well just run it all when needed. It won't take long to copy things around.

Are there specific sheets to copy? eg:

VBA Code:
Sub FindingLastRow()

Dim sht As Worksheet
Dim master As Worksheet
Dim LastRow As Long
Dim MLastRow As Long

Set master = Sheets("CopyData")

''added a bit to clear out CopyData

MLastRow = master.Cells(master.Rows.Count, "A").End(xlUp).Row
master.Range("A3:I" & MLastRow).ClearContents


''then this will do A sheet, so copy and repeat, changing the sheet name

Set sht = Sheets("StockRoom")
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
MLastRow = master.Cells(master.Rows.Count, "A").End(xlUp).Row
sht.Range("A3:I" & LastRow).Copy master.Range("A" & MLastRow + 1)

''end of copy section


End Sub

Or is it all sheets Except CopyData?

VBA Code:
Sub FindingLastRowAllOtherSheets()

Dim sht As Worksheet
Dim master As Worksheet
Dim LastRow As Long
Dim MLastRow As Long

Set master = Sheets("CopyData")

''added a bit to clear out CopyData
MLastRow = master.Cells(master.Rows.Count, "A").End(xlUp).Row
master.Range("A3:I" & MLastRow).ClearContents

For Each sht In ThisWorkbook.Worksheets
    If sht.Name <> "CopyData" Then
        LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
        MLastRow = master.Cells(master.Rows.Count, "A").End(xlUp).Row
        sht.Range("A3:I" & LastRow).Copy master.Range("A" & MLastRow + 1)
    End If
Next sht
''end of copy section

End Sub
 
Upvote 0
Solution
Yes there are specific sheets.
I tried your 2nd code but as there are 2 hidden sheets it was pulling the info from them too, is there a way to exclude them? If not no worrys the first code seems to work well and i can add certain sheets to pull info from.
 
Upvote 0
Should be

VBA Code:
If sht.Name <> "CopyData" and sht.Name <> "otherone"  and sht.Name <> "another" Then

*I always mess this up. If and doesn't work, try or
 
Upvote 0
that works! lol i was being a numpty

Thanks for your help buddy works a treat now (y)
 
Last edited:
Upvote 0
Slight issue...
I have noticed that after a certain amount of copied rows that some formulas don't seem to work which vlookup from a hidden sheet. Weird thing is that the formula is in the cells but I get #Value! error even though the cells above with the numbers have the same formula and copied from the same sheet :confused:
 

Attachments

  • Screenshot 2021-05-29 at 00.30.32.png
    Screenshot 2021-05-29 at 00.30.32.png
    26.9 KB · Views: 3
Upvote 0
Book1
ABCDEF
1productwarehouselong_descriptionbin_numberphysical_qtyon_order_qty
209063LCDELETED - YELLOW SELF SEAL BIOHAZARD BAGLC400
3100 VIAL BOXLCClear100 Box for 0.5-2ml Vials130
41001-8910LC500ML PP CENTRIFUGELC2015
51004-4870LC60ML NALGENE BOTTLESLC420
61005-4870LC125ML NALGENE BOTTLESLC1990
71008-0264LCDELETED - 5ML PLASTIPAK SYRINGESLC00
81012-7400LC5ML PIPETTES INIVIDUAL WRAPLC1240
9102000LCDELETED - 3ML GLASS VIALSLC00
10102010LC3ML AMBER GLASS VIALSLC00
11102040LCDELETED - 11ML GLASS VIALSLC00
12102058LCPolyflux 17L Dialysis Cartridges 1 x 2400
131188-9610LCDELETED - NITRILE GLOVES MEDIUMLC200
141189-9610LCDELETED - NITRILE PURPLE GLOVES (LRG)LC200
1512004271LCZE5 AdditiveLC1601
1612004272LCCytometer CleanerLC2130
1712004403LCZE Series QC Bead, 5ml, Pack of 3LC2120
181203-9817LC2ML PLASTIPAK SYRINGESLC1000
191204-4717LC20ML PLASTIC SYRINGESLC1000
201231-9149LC5ML PLASTIPAK SYRINGESLC1000
211234-0479LCDELETED -STERILIZATION POUCHES 10 X 25CMLC00
221235-0489LCDELETED - AUTOCLAVE TAPELC00
231236-2439LCDELETED - SHARPS CONTAINER 7LITRESLOFT00
241237-8657LCDELETED - HAND CREAMLC1400
251240-2330LCDELETED - PAPER TOWEL ROLLLC00
261245-7896LCMILLIPORE STERICUP VACUM FILTER UNITLC1300
271260-4617LCEPPENDORF 2.5 ML COMBI TIPSLC920
281262-4597LC50ML EPPENDORF COMBITIP PLUSLC2020
291265-1406LC50ML PLASTIPAK SYRINGESLC1000
301265-7636LCEPPENDORF 10ML COMBI TIPLC920
311269-4587LCEPPENDORF 5 ML COMBI TIPSLC9914
321270-9005LCDELETED - STERILAZATION POUCHES 10x15cmLC00
331275-4296LCDELETED - PAPER TOWEL ROLLLC1500
341275-9005LCDELETED - STERILI POUCHES (20x27cm)LC1400
351278-9005LCDELETED -STERILIZATION POUCHES (30X51cm)LC00
361279-9985LCDELETED - 7ML PLASTIC BIJOUSLC400
371292-2850LCDELETED - 250ML DIAMOND WEIGHLC1000
381299-2840LCDELETED - 5ML DIAMOND WEIGH BOATLC1000
391351114LCVIVAFIX 398/550LCLAB20110
401351118LCVIVAFIX 649/660LCLAB20120
411351303LCDAPIELAB2000
421450016LCTC10/TC20 COUNTING SLIDESELABRT00
431450022LCTRYPAN BLUEELABRT00
441514-6686LCDELETED - DISINFECTANT WIPESLC14 COSH00
45151515LCPOLY BOX 150X150X150MM (LV012) AND OUTERLC/P800
461525-3837LC3ML PASTEUR PIPETTELC7167
471560-1944LCDELETED - AUTOCLAVE TAPELC400
481564-1954LCDELETED - STERILAZATION POUCHES 10x15cmLC1700
491564-9795LCDELETED - ALCOHOL WIPESLC14 COSH00
501565-1954LCDELETED -STERILIZATION POUCHES 10 X 25CMLC1300
511573-0679LCDELETED - STERI POUCH 13.5 X 26CMLC1300
521578-0319LCMILLIPORE STERICUP VACUM FILTER UNITLC1500
531581-7531LCSARTOLAB P FILTERSLC1100
5415879152LC10ML PLASTIC SYRINGESLC1030
551610393LCPRECISION ALL BLUE STD (PK 5)LCLAB20120
561610396LCUNSTAINED PROTEIN STANDARDS (5PK)LCLAB20120
571610610LCDITHIOTHREITOL (DTT)LCLAB2820
581610737LCLAEMMLI SAMPLE BUFFERLC1630
591610747LCLAEMMLI SAMPLE BUFFER (4x)LC1630
601610772LCTGS (10x)LC1740
611704157LCPVDF TRANSBLOT TRANSFER PACKLCLAB2850
621704159LCMIDI NITROCELLULOSE TURBO TRANSFER PACKLCLAB28120
631704275LCTRANS-BLOT LF PVDF TRANSFER KITELABRT00
641705061LCCLARITY WESTERN ECL SUBSTRATE, 500MLLC1650
651710-0803LCPAPER LAB COATS - LARGELOFT00
661710-0804LCDELETED PAPER LAB COATS - EXTRA LARGELOFT00
671710-0805LCPAPER LAB COATS - EXTRA EXTRA LARGELOFT00
681710-0915LCDELETED - SHOE COVERSLC2600
6918072-DLCDELETED - SARTOLAB P FILTERSLC1100
7020X30LC20X30 BAGS 250gLOFT30
71262626LCCL17-05 PELI POLY BOX 26X26X26 AND OUTERLC/P800
72292926LCMED DRY ICE BOX 283X283X259MMLC/P800
73292926INNERLCMEDIUM DRY BOX 29X29X26 INNER ONLYLC/P800
74300180LC15.5MM WADLESS CAPSLC00
75300203LC22MM WADLESS CAPSLC00
76302323LCDOUBLE WALLED STOCK BOX 305X228X228MMLC/P800
77303030LCPELI POLY BOX 300X3000X300MM AND OUTERLC/P800
7830389256LC5ML TIPSLC930
7930389279LCTIPS 50-1000UL TRADLC720
8030389283LCRAININ STD REFILL TIPSLC750
8130389287LCTIPS 2-250UL TRAD SPACE SAVERLC740
8230389291LCTIPS 0.1-20UL SPACESAVER PK960 LTSLC7821
8330389292LCTIPS 50-1000UL SPACESAVER PK768 LTSLC71726
8430389299LCTIPS 2-200UL SPACESAVER PK960 LTSLC71315
8530389303LCTIPS 50-1000UL SPACESAVER PK768 LTSLC700
86312313LCMEDIUM SINGLE WALLED BOX 305X228X130MMLC/P800
87313131LCDOUBLE WALLED STOCK BOX 305X305X305MMLC/P800
88342800-0020LCDELETED - 2ML CLEAR VIALS (0331380B)LC00
89342805-0020LC2ML AMBER VIALS (339027)LC00
90342820-0116LCDELETED - BLUE LIDS (0331381G)LC00
91342820-1110LCNATURAL/TEAL CLOSURELC2120
92342825-0110LCDELETED - AMBER LIDS (33909)LC00
93342825-0116LCDELETED - AMBER/BLUE LIDS (033903)LC00
94352008LCBD 12 X 75MM TUBESLC161828
95362800-0005LC0.5ML NATURAL VIALSLC12428
96362800-0020LC2ML NATURAL VIALSLC1110
97362805-0005LC0.5ML AMBER VIALS (339028)LC380
98362805-0020LC2ML AMBER VIALSLC160
99362820-0110LCNATURAL CLOSURELC32428
100362820-0116LCNATURAL CLOSURE WITH BLUE INSERTLC300
101362825-0111LCAMBER CLOSURELC300
102362825-0112LCAMBER CLOSURE WITH YELLOW INSERTLC300
103362825-0115LCAMBER CLOSURE WITH RED INSERTLC300
104362825-0116LCAMBER CLOSURE WITH BLUE INSERTLC300
Stk_Qty-LC



Book1
ABCDEFGHI
2Flow Tubes3520081 Box1 Box2 Boxes18LC16
32 x Laemmli *16107371 Bottle0 Bottles1 Bottle#N/A#N/A
44 x Laemmli *16107471 Bottle0 Bottles1 Bottle#N/A#N/A
510 x TGS running buffer *16107721 Box0 Boxes1 Box#N/A#N/A
6CRITERION 4-15% TGX STAIN-FREE GEL5678084Storage in the cold room15 gelsReplenish stock to 25 gels#N/A#N/A
7ANY KD CRITERION TGX STAIN-FREE GEL5678124Storage in the cold room15 gelsReplenish stock to 25 gels#N/A#N/A
8LTS L10 refill tips303892911 Tower1 Tower1 Tower#N/A#N/A
9LTS L1000 refill tips303892921 Tower2 Towers3 Towers#N/A#N/A
10LTS L200 refill tips303892991 Tower1 Tower1 Tower#N/A#N/A
115 ml stripette1012-74001 Bag2 Bags (½ Box)2 Boxes4LC12
1250 ml falcon tubes1033-41311 Tray12 Trays1 Box of 500#N/A#N/A
135 ml Gilson tips1035-78521 Bag01 Box#N/A#N/A
1415 ml falcon tubes1057-96911 Tray5 Trays2 Boxs of 500#N/A#N/A
1550 ml stripettes1063-63911 Bag2 Bags (½ Box)1 Boxes#N/A#N/A
161.8 ml cryovials1067-45111 Box01 Box#N/A#N/A
1710 ml stripette1067-73411 Bag2 Bags (½ Box)1 Box#N/A#N/A
labstock
Cell Formulas
RangeFormula
F2:F17F2=VLOOKUP([@product],'Stk_Qty-LC'!A:F,5,FALSE)
G2:G17G2=VLOOKUP([@product],'Stk_Qty-LC'!A:F,4,FALSE)
Named Ranges
NameRefers ToCells
'Stk_Qty-LC'!Query_from_CRSS='Stk_Qty-LC'!$A$1:$F$104F2:G17
 
Upvote 0
Just made a temp sheet with some data to test but as you can see on the labsheet cell F3 is showing N/A with the same formula as F2
 
Upvote 0
Strange it gets a couple of results. What's the result on the below?

='labstock'!B2='Stk-Qty-LC'!A58
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,734
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top