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

Hi All,

I get the type mismatch error on this line of code

TmpCB.Sheets("03-10").Cells(z, 2).Value =
OldCB.Sheets("032010").Cells(x, 2).Value + " - " +
OldCB.Sheets("032010").Cells(x, 3).Value


I know that cells(x,2) at this poin in the code is "check run" and
Cells(x,3) is "4277"
I'm sure it's because "check run" is text and "4277" is a number, but I
can't figure a way around it. I've tried doing .text instead of .value but it
still didn't work.

Can someone help me fix this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Type Mismatch



Use "&" instead of "+" 'no quote marks
--
Jim Cone
Portland, Oregon USA




"GTyson2"
wrote in message ...
Hi All,

I get the type mismatch error on this line of code

TmpCB.Sheets("03-10").Cells(z, 2).Value =
OldCB.Sheets("032010").Cells(x, 2).Value + " - " +
OldCB.Sheets("032010").Cells(x, 3).Value


I know that cells(x,2) at this poin in the code is "check run" and
Cells(x,3) is "4277"
I'm sure it's because "check run" is text and "4277" is a number, but I
can't figure a way around it. I've tried doing .text instead of .value but it
still didn't work.

Can someone help me fix this?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Type Mismatch

It looks like you're trying to build a string.

Try using &'s instead of +'s.

TmpCB.Sheets("03-10").Cells(z, 2).Value _
= OldCB.Sheets("032010").Cells(x, 2).Value & " - " & _
OldCB.Sheets("032010").Cells(x, 3).Value

GTyson2 wrote:

Hi All,

I get the type mismatch error on this line of code

TmpCB.Sheets("03-10").Cells(z, 2).Value =
OldCB.Sheets("032010").Cells(x, 2).Value + " - " +
OldCB.Sheets("032010").Cells(x, 3).Value

I know that cells(x,2) at this poin in the code is "check run" and
Cells(x,3) is "4277"
I'm sure it's because "check run" is text and "4277" is a number, but I
can't figure a way around it. I've tried doing .text instead of .value but it
still didn't work.

Can someone help me fix this?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Type Mismatch

Have you tried replacing + with & ?
--
HTH,

Barb Reinhardt



"GTyson2" wrote:

Hi All,

I get the type mismatch error on this line of code

TmpCB.Sheets("03-10").Cells(z, 2).Value =
OldCB.Sheets("032010").Cells(x, 2).Value + " - " +
OldCB.Sheets("032010").Cells(x, 3).Value


I know that cells(x,2) at this poin in the code is "check run" and
Cells(x,3) is "4277"
I'm sure it's because "check run" is text and "4277" is a number, but I
can't figure a way around it. I've tried doing .text instead of .value but it
still didn't work.

Can someone help me fix this?

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
Type mismatch: array or user-defined type expected Naftas Excel Programming 0 March 23rd 10 12:38 PM
type mismatch Janis Excel Programming 3 September 4th 06 11:13 PM
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM


All times are GMT +1. The time now is 09:57 AM.

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"