![]() |
Sum values form different tabs
I need a macro that will sum the values from Cell A7 from every tab in the
current spread sheet however excluding three tabs " SheetABC", "SheetMNH" and "SheetXYZ" and insert the result in Cell A7 in "SheetMNH" Then i want to do the same with the values in Cell A8, A9, A10 and A11 and put the results in A8, A9, A10 and A11 in "SheetMNH". Any help will be very much appreciated! Thanks |
Sum values form different tabs
Hi
Try the sandwich Tip on the page http://www.rondebruin.nl/linksum.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "vlad" wrote in message ... I need a macro that will sum the values from Cell A7 from every tab in the current spread sheet however excluding three tabs " SheetABC", "SheetMNH" and "SheetXYZ" and insert the result in Cell A7 in "SheetMNH" Then i want to do the same with the values in Cell A8, A9, A10 and A11 and put the results in A8, A9, A10 and A11 in "SheetMNH". Any help will be very much appreciated! Thanks |
Sum values form different tabs
Couple different ways this could be done. Here is a quickie. This
will do A7 through A11. If you need to go further than row 11, just change the finalRow variable. Sub sumThis() Dim ws As Worksheet, finalRow As Long Dim mainWS As Worksheet, s As Long Dim i As Integer 'change to Long if needed Set mainWS = Sheets("SheetMNH") finalRow = 11 'change as needed For i = 7 To finalRow s = 0 For Each ws In ActiveWorkbook.Worksheets If Not ws.Name = "SheetMNH" _ And Not ws.Name = "SheetABC" _ And Not ws.Name = "SheetXYZ" Then _ s = s + ws.Cells(i, 1) Next ws mainWS.Cells(i, 1) = s Next i Set mainWS = Nothing End Sub vlad wrote: I need a macro that will sum the values from Cell A7 from every tab in the current spread sheet however excluding three tabs " SheetABC", "SheetMNH" and "SheetXYZ" and insert the result in Cell A7 in "SheetMNH" Then i want to do the same with the values in Cell A8, A9, A10 and A11 and put the results in A8, A9, A10 and A11 in "SheetMNH". Any help will be very much appreciated! Thanks |
Sum values form different tabs
Ron and JW,
Many thanks i tried bought and they work. Thanks again "vlad" wrote: I need a macro that will sum the values from Cell A7 from every tab in the current spread sheet however excluding three tabs " SheetABC", "SheetMNH" and "SheetXYZ" and insert the result in Cell A7 in "SheetMNH" Then i want to do the same with the values in Cell A8, A9, A10 and A11 and put the results in A8, A9, A10 and A11 in "SheetMNH". Any help will be very much appreciated! Thanks |
All times are GMT +1. The time now is 06:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com