Wrox Programmer Forums Code error
 |
 Excel VBA Discuss using VBA for Excel programming.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Excel VBA 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

November 15th, 2006, 02:05 AM
 reverand Authorized User Join Date: Nov 2005 Posts: 14 Thanks: 0 Thanked 0 Times in 0 Posts
Code error

I'm trying to get this program done to make work go faster, but since I've givin up and am going to bed right now, I'm going to post it and see if anyone can point out my mistake.

Private Sub CommandButton1_Click()
i = 1
j = 1
k = 1
l = 1
Do While i <= 65536
Do While l <= 65536
If Sheet1.Cells(i, j).Value = 0 Then
ElseIf Sheet1.Cells(i, j).Value = (Left(Sheet2.Cells(l, 1), 4) & Right(Sheet2.Cells(l, 1), 4)) * 1 Then
Sheet3.Cells(k, 1).Value = Sheet1.Cells(i, j).Value
k = k + 1
l = l + 1
Else
l = l + 1
End If
Loop
If i >= 65536 And j = 1 Then
i = 1
j = 2
ElseIf i >= 65536 And j = 2 Then
ElseIf i < 65536 Then
i = i + 1
End If
Loop
End Sub
The highlighted line gives me a Type Mismatch error.

November 15th, 2006, 02:08 AM
 echovue Friend of Wrox Join Date: Oct 2004 Posts: 564 Thanks: 0 Thanked 4 Times in 4 Posts

I wonder if the value in Sheet1 is coming out as a string? In that case, you could either multiply that by 1, or see if you could take the *1 off the second part.

Hope that helps,

Mike

Mike
EchoVue.com

 Similar Threads Thread Thread Starter Forum Replies Last Post Re: Code Error rhapsidee VB.NET 2002/2003 Basics 1 May 27th, 2008 07:04 AM Error in Code NadAf BOOK: Ivor Horton's Beginning Visual C++ 2005 0 February 18th, 2008 11:16 PM Code error??? emyr BOOK: Beginning Java 2 1 October 31st, 2006 05:47 PM Code error!?!? Brian Campbell BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 November 26th, 2004 07:47 PM Error displayed with error trap code stoneman Access 4 February 28th, 2004 02:53 PM