Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Type mismatch error

I am having trouble where cells that look empty have a space in them.



The watch window in VBA shows the value for
UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value as value: " ", type:
Variant/String



When the cell ((Row + 7), Column has a value of " " the line:

Tags.SegParam_3.Value = UserForm1.Spreadsheet1.Cells(TempRow, Column).Value
+ Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

Causes a <Type mismatch error when it runs. If I do a delete on the cell or
put a number in the cell the code will run fine for a while then the space
finds its way back into the cell and the problems starts again.



I have tried:

Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

CDbl(Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value))

And a few other things with no joy



I am calling VBA from a program called InteractX by CTC and this happens on
machines using Excel 2003 and 2007



If there is a more appropriate group to post this to please let me know.



Thanks In Advance

Chris


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default VBA Type mismatch error

Couple of things you can try...
If IsNumeric(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value) Then
'add them up
-or-
Tags.SegParam_3.Value = _
UserForm1.Spreadsheet1.Cells(TempRow, Column).Value + _
Val(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

Also, "Column" and "Row" are properties of the Range object,
so Excel already uses them. You might want to use different names.
--
Jim Cone
Portland, Oregon USA



"Chris H"
wrote in message
I am having trouble where cells that look empty have a space in them.

The watch window in VBA shows the value for
UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value as value: " ", type:
Variant/String
When the cell ((Row + 7), Column has a value of " " the line:

Tags.SegParam_3.Value = UserForm1.Spreadsheet1.Cells(TempRow, Column).Value
+ Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

Causes a <Type mismatch error when it runs. If I do a delete on the cell or
put a number in the cell the code will run fine for a while then the space
finds its way back into the cell and the problems starts again.
I have tried:

Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

CDbl(Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value))

And a few other things with no joy
I am calling VBA from a program called InteractX by CTC and this happens on
machines using Excel 2003 and 2007
If there is a more appropriate group to post this to please let me know.
Thanks In Advance
Chris


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Type mismatch error


You can't call UserForm1.Spreadsheet1.Cells...etc, the userform is not
an object or property of the spreasdhseet (sheet or sheets), the
userform will have either comboboxes, listboxes or textboxes that will
hold values.

Chris H;246471 Wrote:
I am having trouble where cells that look empty have a space in them.

The watch window in VBA shows the value for

Code:
--------------------

UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value as value: " ", type:
Variant/String

--------------------


When the cell ((Row + 7), Column has a value of " " the line:


Code:
--------------------

Tags.SegParam_3.Value = UserForm1.Spreadsheet1.Cells(TempRow, Column).Value
+ Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

--------------------

Causes a <Type mismatch error when it runs. If I do a delete on the
cell or
put a number in the cell the code will run fine for a while then the
space
finds its way back into the cell and the problems starts again.

I have tried:

Code:
--------------------


Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value)

CDbl(Trim(UserForm1.Spreadsheet1.Cells((Row + 7), Column).Value

--------------------
))


And a few other things with no joy

I am calling VBA from a program called InteractX by CTC and this
happens on
machines using Excel 2003 and 2007

If there is a more appropriate group to post this to please let me
know.

Thanks In Advance

Chris



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=68796

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default VBA Type mismatch error

"Spreadsheet1" is the default name for the Microsoft Spreadsheet Control.
It can be found in the "additional controls" option on the VBE Toolbox.
--
Jim Cone
Portland, Oregon USA



"Simon Lloyd"

wrote in message
You can't call UserForm1.Spreadsheet1.Cells...etc, the userform is not
an object or property of the spreasdhseet (sheet or sheets), the
userform will have either comboboxes, listboxes or textboxes that will
hold values.
--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
runtime error 13 - type mismatch error in Excel 97 on Citrix Kevin Maher Excel Programming 7 March 8th 08 11:48 AM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"