+ Reply to Thread
Results 1 to 2 of 2

Summing data across excell sheets in a summary sheet using macro

  1. #1
    Registered User
    Join Date
    09-30-2011
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    1

    Summing data across excell sheets in a summary sheet using macro

    Hello,
    I am stuck with the following. Any help on the same would be much appreciated.
    '''''''''''''''''''''''''''''''''''''''
    I want to add cell B1 in all the worksheets of a workbook and put it in cell B1 of the summary sheet. I want to do it for all the sheets in the worksheet staring with name Satish. I want to repeat the above activity for each cell in the range B1 to D5 in the sheet summary. The follwing code doesn't work. Please help me fix it up.
    ........................
    Sub consolidate()

    Dim j As Long, k As Long, tot As Double
    Dim c As Range

    For Each c In Worksheets("master").Range("B1:D5")

    j = Worksheets.Count
    tot = 0
    For k = 1 To j
    If Worksheets(k).Name <> "master" Then
    If LCase(Left(Worksheets(k).Name, 5)) = "satish" Then

    tot = tot + Worksheets(k).c.Cells(1).Value
    End If
    End If

    Next k

    Worksheets("master").c = tot

    Next c
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Thanking you for your sugggestions in advance.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Summing data across excell sheets in a summary sheet using macro

    satishsahoo,

    Please add code tags to your code per forum rules. See link in my sig
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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