Results 1 to 7 of 7

Summing all rows in a user inputted column

Threaded View

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Summing all rows in a user inputted column

    Hello,

    Originally I asked this on vbaexpress, but that website appears to have gone away

    I need to sum all the rows, except the header row, of a column inputted by the user. The column will be located in a worksheet dubbed SourceSheet.

    Here's a few pieces of code related to what I am trying to do. The header row is always row 1. So the rows I'm summing are always 2 - myrows.

    Let me know if I left anything out, or if you have any questions.

    Thanks in advance.

    Sub CreateMatrixVector()
        Dim SourceSheet As Worksheet
        Dim WeightingRange As String
        Dim MyRows As Long
        Dim MySum As Long
                        
    'Original worksheet
        Set SourceSheet = ActiveSheet
        
    'Prompt for Weighting Range
        WeightingRange = InputBox("Please enter the column letter of the column used for weighting")
      
    'Count the number of rows in the worksheet
        MyRows = SourceSheet.UsedRange.Rows.Count
    
    End Sub
    Last edited by NukedWhale; 02-02-2009 at 07:07 PM. Reason: Solved

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