Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default A VB problem with a if structure

Hi, trayng the following macro:
bla bla bla
If Cells(contr, 1) = NumeroDeControl Then
comp = 1
end if
bla bla bla

an error apears (ERR 2042), this happends because in the cell( contr,1) I
have the #N/A, but we know (you and me, because VB didn't)THE IF STRUCTURE IS
FALSE so my macro should jump the comp=1
How to thell VB that no matter what kind of value are in cells(contr,1) the
if structure must continue

I've tried everithing (declaring NumeroDeControl as string didn't work, not
declaring at all NumeroDeControl neither)
HTHS
TIa
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default A VB problem with a if structure

Check for the error before testing for the value:
If Not (IsError(Cells(1, 1))) Then
If Cells(1, 1) = NumeroDeControl Then
comp = 1
End If
End If


"filo666" wrote:


Hi, trayng the following macro:
bla bla bla
If Cells(contr, 1) = NumeroDeControl Then
comp = 1
end if
bla bla bla

an error apears (ERR 2042), this happends because in the cell( contr,1) I
have the #N/A, but we know (you and me, because VB didn't)THE IF STRUCTURE IS
FALSE so my macro should jump the comp=1
How to thell VB that no matter what kind of value are in cells(contr,1) the
if structure must continue

I've tried everithing (declaring NumeroDeControl as string didn't work, not
declaring at all NumeroDeControl neither)
HTHS
TIa

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
Help with formula structure Richard Excel Discussion (Misc queries) 4 October 7th 06 02:35 AM
data structure and my problem samantha Excel Worksheet Functions 2 April 11th 05 02:38 PM
if structure help filo666 Excel Programming 4 March 1st 05 08:37 PM
Nested with structure David Excel Programming 2 October 22nd 03 01:54 PM
Structure of If...Else in VBA John Wilson Excel Programming 2 July 30th 03 04:33 AM


All times are GMT +1. The time now is 08:25 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"