![]() |
macro for excel, automate task
Hi,
I need some help. I'm not smart enough to figure this out, so I thought some smart people may be able to help. I need to automate a task. I need a macro that will fill in the following totals. example sheet: A 5 B 6 C 7 TOTAL D 5 E 6 F 7 TOTAL G 5 H 6 I 7 TOTAL The titles(letters) are in column "A" and values in column "B". I need a macro that will give me sub totals in column B where the A column states total. How can I do this? I have several thousand sub-totals I need and doing it manually would take weeks. thank you |
macro for excel, automate task
Option Explicit Sub xxx() Dim dblRowCounter As Double Dim dblSubTOTAL As Double dblRowCounter = 1 dblSubTOTAL = 0 Do Until Cells(dblRowCounter, 1) = "" dblSubTOTAL = dblSubTOTAL + Cells(dblRowCounter, 2) If Cells(dblRowCounter, 1) = "TOTAL" Then Cells(dblRowCounter, 2) = dblSubTOTAL dblSubTOTAL = 0 End If dblRowCounter = dblRowCounter + 1 Loop End Sub -- bgeier ------------------------------------------------------------------------ bgeier's Profile: http://www.excelforum.com/member.php...o&userid=12822 View this thread: http://www.excelforum.com/showthread...hreadid=543082 |
macro for excel, automate task
Uzytkownik napisal w wiadomosci oups.com... Hi, I need some help. I'm not smart enough to figure this out, so I thought some smart people may be able to help. I need to automate a task. I need a macro that will fill in the following totals. example sheet: A 5 B 6 C 7 TOTAL D 5 E 6 F 7 TOTAL G 5 H 6 I 7 TOTAL The titles(letters) are in column "A" and values in column "B". I need a macro that will give me sub totals in column B where the A column states total. How can I do this? I have several thousand sub-totals I need and doing it manually would take weeks. thank you i think you dont need macro to have that first add headers to your sheet then add one additional column next to col B - give it a header and fill down with anything ( to the end of data in col A) i assume your data will start in a2 totals will appear in 6,12,18 ... rows in b6 we should have first sum of totals - just insert there simple formula sum(b2:b4) then use autofilter on first row and select total in column A copy down formula from b6 autofilter - show all should work mcg |
macro for excel, automate task
thank you, this is very helpful
|
macro for excel, automate task
I don't exactly follow what you mean on this exampe, can you give an
exampe? |
All times are GMT +1. The time now is 10:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com