You COULD add a "On Error Resume Next"
if this type of thing could potentially happen again.


BTW:  what is it that the code is intended to do?

It seems to run fairly slowly.

I bet I could speed it up!

although.. if it does what you want.. I guess there's no need to fix it.
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: Paul Schreiner <schreiner_p...@att.net>
To: excel-macros@googlegroups.com
Sent: Fri, November 2, 2012 12:53:16 PM
Subject: Re: $$Excel-Macros$$ $$excel-macro-vba for sumif function-type 
mismatch 
error-reg


The problem is that Cells D263 and D355 have a space in them.
When you try to issue  k = k + " ",
you get a "Type Mismatch" because you cannot add a space to an integer
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: karunanithi ramaswamy <era_...@yahoo.com>
To: "excel-macros@googlegroups.com" <excel-macros@googlegroups.com>
Sent: Fri, November 2, 2012 12:19:34 PM
Subject: $$Excel-Macros$$ $$excel-macro-vba for sumif function-type mismatch 
error-reg


Dear Experts,

      I wrote a vba for replacing the sumif function in my own way.  It works 
for few datas(sheet2) it works fine.
the vba is as follows:

Sub sumb()
Dim i, j  As Integer
Dim k, l, m, n As Long
k = 0
l = 0
m = 0
n = 0
For i = 2 To 5
   For j = 2 To 17
       If Cells(i, 8).Value = Cells(j, 1).Value Then
       k = k + Cells(j, 2).Value
       l = l + Cells(j, 3).Value
       m = m + Cells(j, 4).Value
       n = n + Cells(j, 5).Value
       
       
       
       Cells(i, 9).Value = k
       Cells(i, 10).Value = l
       Cells(i, 11).Value = m
       Cells(i, 12).Value = n
       
       
       End If
   Next
       k = 0
       l = 0
       m = 0
       n = 0
       
 Next
   
End Sub

for around 700 datas it is not working and shows as error message as "type 
mismatch" (see sheet 1.from column t to y.
sum if function works fine. but I wish to work with vba. I will be thankful, if 
anyone corrects the mistakes in the 

following code:

Sub sum2()
Dim i, j  As Integer
Dim k, l, m, n, p As Long
k = 0
l = 0
m = 0
n = 0
p = 0
For i = 2 To 23
   For j = 2 To 690
       If Cells(i, 20).Value = Cells(j, 3).Value Then
       k = k + Cells(j, 4).Value
       l = l + Cells(j, 5).Value
       m = m + Cells(j, 6).Value
       n = n + Cells(j, 7).Value
       p = p + Cells(j, 8).Value
       
       
       
       
       
       
       End If
   Next
   
       Cells(i, 21).Value = k
       Cells(i, 22).Value = l
       Cells(i, 23).Value = m
       Cells(i, 24).Value = n
       Cells(i, 25).Value = p
       
       k = 0
       l = 0
       m = 0
       n = 0
       p = 0
       
 Next
   
End Sub


-R.Karunanithi.
9486100934.-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES (1120+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

 
6) Jobs posting is not allowed.
 
7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners 
and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
 
 
-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES (1120+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

 
6) Jobs posting is not allowed.
 
7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners 
and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.

-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES (1120+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

6) Jobs posting is not allowed.

7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.


Reply via email to