+ Reply to Thread
Results 1 to 7 of 7

Visual Basic Code

Hybrid View

  1. #1
    Don Guillett
    Guest

    Re: Visual Basic Code

    You don't give a lot of detail and it sounds like homework but try this idea

    Sub sumvarrows()
    ac = 9
    fr = 2 'or inputbox("Enter first row")
    lr = Cells(Rows.Count, ac).End(xlUp).Row
    MsgBox Application.Sum(Range(Cells(fr, ac), Cells(lr, ac)))
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "Mike" <mike@mike1313.wanadoo.co.uk> wrote in message
    news:uv%23svHskGHA.4200@TK2MSFTNGP05.phx.gbl...
    > Hi All,
    >
    > I want to write a macro that totals the values in consecutive rows in a
    > column in an Excel Spreadsheet.
    > The start and end rows will alter so I will have to use variables to
    > define the starting and the finishing cell.
    > Can anyone help me write a formula that will do this,
    >
    > Thanks Mike.
    >




  2. #2
    Mike
    Guest

    Re: Visual Basic Code

    Thanks for your help, all sorted now.

    "Don Guillett" <dguillett1@austin.rr.com> wrote in message
    news:upLa69skGHA.5036@TK2MSFTNGP04.phx.gbl...
    > You don't give a lot of detail and it sounds like homework but try this
    > idea
    >
    > Sub sumvarrows()
    > ac = 9
    > fr = 2 'or inputbox("Enter first row")
    > lr = Cells(Rows.Count, ac).End(xlUp).Row
    > MsgBox Application.Sum(Range(Cells(fr, ac), Cells(lr, ac)))
    > End Sub
    >
    > --
    > Don Guillett
    > SalesAid Software
    > dguillett1@austin.rr.com
    > "Mike" <mike@mike1313.wanadoo.co.uk> wrote in message
    > news:uv%23svHskGHA.4200@TK2MSFTNGP05.phx.gbl...
    >> Hi All,
    >>
    >> I want to write a macro that totals the values in consecutive rows in a
    >> column in an Excel Spreadsheet.
    >> The start and end rows will alter so I will have to use variables to
    >> define the starting and the finishing cell.
    >> Can anyone help me write a formula that will do this,
    >>
    >> Thanks Mike.
    >>

    >
    >




  3. #3
    Don Guillett
    Guest

    Re: Visual Basic Code

    For archival purposes it is always nice to post your final solution for the
    benefit of others.

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "Mike" <mike@mike1313.wanadoo.co.uk> wrote in message
    news:ORXqhSwkGHA.2304@TK2MSFTNGP02.phx.gbl...
    > Thanks for your help, all sorted now.
    >
    > "Don Guillett" <dguillett1@austin.rr.com> wrote in message
    > news:upLa69skGHA.5036@TK2MSFTNGP04.phx.gbl...
    >> You don't give a lot of detail and it sounds like homework but try this
    >> idea
    >>
    >> Sub sumvarrows()
    >> ac = 9
    >> fr = 2 'or inputbox("Enter first row")
    >> lr = Cells(Rows.Count, ac).End(xlUp).Row
    >> MsgBox Application.Sum(Range(Cells(fr, ac), Cells(lr, ac)))
    >> End Sub
    >>
    >> --
    >> Don Guillett
    >> SalesAid Software
    >> dguillett1@austin.rr.com
    >> "Mike" <mike@mike1313.wanadoo.co.uk> wrote in message
    >> news:uv%23svHskGHA.4200@TK2MSFTNGP05.phx.gbl...
    >>> Hi All,
    >>>
    >>> I want to write a macro that totals the values in consecutive rows in a
    >>> column in an Excel Spreadsheet.
    >>> The start and end rows will alter so I will have to use variables to
    >>> define the starting and the finishing cell.
    >>> Can anyone help me write a formula that will do this,
    >>>
    >>> Thanks Mike.
    >>>

    >>
    >>

    >
    >




+ 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