Wrox Programmer Forums
BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2
This is the forum to discuss the Wrox book Excel 2007 VBA Programmer's Reference by John Green, Stephen Bullen, Rob Bovey, Michael Alexander; ISBN: 9780470046432
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 15th, 2010, 03:32 PM
Registered User
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Type Mismatch


Can't figure out where exactly is the "type mismatch" error. The sumifs should return a double, don't know what type is Activecell.value. Or could it be some mismatch in the arguments-am I writing them correctly?

Please help if anyone has any ideas/solutions


Dim CellVal As Double
    Dim i As Long, j As Long
    i = 3
    j = 31
    Worksheets("Jan").Cells(i, j).Activate
    Do Until IsEmpty(Cells(i, j - 2))
        CellVal = WorksheetFunction.SumIfs(Range("W2:W20000"), Range("S2:S20000"), Range("U2:U20000"), Cells(i, j - 2), Cells(1, j))
        ActiveCell.Value = CellVal
        i = i + 1
        Cells(i, j).Activate
Old June 18th, 2010, 11:12 PM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts


You should have specified the criteria in the third argument.

For example

CellVal = WorksheetFunction.SumIfs(Range("B2:B4"), Range("C2:C4"), "pp1992")

Searches for pp1992 in range C2 to C4 and sums the range B2:B4

C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)

Similar Threads
Thread Thread Starter Forum Replies Last Post
type mismatch peonysmiles ASP.NET 1.0 and 1.1 Basics 0 August 26th, 2008 08:38 AM
type mismatch frresh Pro Visual Basic 2005 1 April 11th, 2006 08:35 AM
Type mismatch NoBullMan Classic ASP Basics 2 November 16th, 2004 03:16 AM
Type mismatch per.holleufer Classic ASP Basics 5 July 31st, 2004 07:33 AM
Type mismatch sporkman43 Classic ASP Basics 4 August 14th, 2003 03:27 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.