+ Reply to Thread
Results 1 to 5 of 5

macro for excel, automate task

  1. #1

    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


  2. #2
    Forum Contributor
    Join Date
    08-07-2004
    Location
    Ohio, USA
    Posts
    114
    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

  3. #3
    Gazeta
    Guest

    Re: macro for excel, automate task


    Uzytkownik <[email protected]> napisal w wiadomosci
    news:[email protected]...
    > 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



  4. #4

    Re: macro for excel, automate task

    thank you, this is very helpful


  5. #5

    Re: macro for excel, automate task

    I don't exactly follow what you mean on this exampe, can you give an
    exampe?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1