Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
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
 
Old July 23rd, 2010, 12:27 AM
Authorized User
 
Join Date: Mar 2008
Posts: 74
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via ICQ to sektor
Default Excel 2003 can't assign digit to variable

I have a routine which do some calculations. I created it in Excel 2010 and it worked OK, but when I opened it in Excel 2003, then reading cell's value causes "Type mismatch" even when variable is Variant (before variant I used type Double and used conversion function CDbl).

Here's cell's value: 0,927381412344606
Here's variable: Dim vValue as Variant
Here's assigning: dValue = Cells(i, "I")

Is it bug or I did something wrong?
 
Old July 23rd, 2010, 12:47 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Can you Try the following

Dim dValue as Double

dValue = Cells(i, "I")

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

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old July 23rd, 2010, 01:24 AM
Authorized User
 
Join Date: Mar 2008
Posts: 74
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via ICQ to sektor
Default

Yes, I used also this "version", but resultless...
 
Old July 23rd, 2010, 09:08 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Can you try the following:

Code:
Dim vValue As Variant
Dim dValue As Double
vValue = Cells(1, "A")
vValue = Replace(vValue, ",", ".")
dValue = CDbl(vValue)
If it doesn;t. Please post the code and the error you get

Cheers
Shasur
__________________
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
How to assign value to a xslt variable XSLUSer XSLT 1 March 25th, 2009 09:10 AM
assign XSLT variable to a wml variable arunagottimukkala XSLT 2 October 19th, 2007 05:15 AM
assign javascript variable to asp variable manjunath_c_k Classic ASP Basics 1 September 14th, 2006 07:35 AM
assign a recordset to a variable biggen55 VB How-To 1 March 26th, 2004 02:26 PM





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