Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default compare 2 mem variables against a string value

Hey,
Can anyone help here...

If Mdl = "ZDX" Then 'Works fine
If Mdl or Mdl2 = "ZDX" Then 'Generates Type mismatch error

Does anyone know how to check more than one memory variable (Mdl and Mdl2)
against a string value?

Thanks,
RR

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default compare 2 mem variables against a string value

Hi,

The correct syntax is

If Mdl = "ZDX" Or Mdl2 = "ZDX" Then

Mike

"Ron5440" wrote:

Hey,
Can anyone help here...

If Mdl = "ZDX" Then 'Works fine
If Mdl or Mdl2 = "ZDX" Then 'Generates Type mismatch error

Does anyone know how to check more than one memory variable (Mdl and Mdl2)
against a string value?

Thanks,
RR

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default compare 2 mem variables against a string value

Try this

If Mdl="ZDX" or Mdl2 = "ZDX" Then
--
If this helps, please remember to click yes.


"Ron5440" wrote:

Hey,
Can anyone help here...

If Mdl = "ZDX" Then 'Works fine
If Mdl or Mdl2 = "ZDX" Then 'Generates Type mismatch error

Does anyone know how to check more than one memory variable (Mdl and Mdl2)
against a string value?

Thanks,
RR

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default compare 2 mem variables against a string value

I made this same mistake when I was beginning to learn VBA. This is the way
to do it:

If Mdl = "ZDX" OR Mdl = "ZDX" Then
' do something
End if

Hope this helps! If so, click "YES" below.
--
Cheers,
Ryan


"Ron5440" wrote:

Hey,
Can anyone help here...

If Mdl = "ZDX" Then 'Works fine
If Mdl or Mdl2 = "ZDX" Then 'Generates Type mismatch error

Does anyone know how to check more than one memory variable (Mdl and Mdl2)
against a string value?

Thanks,
RR

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
Value compare problem, As Single variables Feb09 Neal Zimm Excel Programming 3 March 1st 09 11:41 PM
Compare variables in two excel workbooks Alex Excel Programming 7 October 29th 08 11:46 PM
String variables John New Users to Excel 3 July 16th 06 09:08 PM
Compare two variables across two worksheets jlcnewyork Excel Worksheet Functions 0 February 14th 06 08:58 PM
Compare two lists with two variables John Excel Worksheet Functions 4 September 11th 05 11:18 PM


All times are GMT +1. The time now is 10:23 PM.

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

About Us

"It's about Microsoft Excel"