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

I have a macro that sets a value to a Range varaible. I then want to check
the contents of the variable and if there is no contents I want to give a
message in a message box. My code is:

Dim rng1 As Range
Set rng1 =
Worksheets(varWorksheetInfoArray(0)).Cells.Find(va rWorksheetInfoArray(1),
LookIn:=xlValues)

If IsEmpty(rng1) = True Then
MsgBox ("Cannot find " & varWorksheetInfoArray(2))
End If

It worked before but now there seems to be a problem since I just get the
uninformative Syntax Error.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Syntax error..

Try:
If rng1 Is Nothing...
IsEmpty is used to test Variants, whilst MyVar Is Nothing is used to test
Objects.

NickHK

"Freddie Mac" wrote in message
...
I have a macro that sets a value to a Range varaible. I then want to check
the contents of the variable and if there is no contents I want to give a
message in a message box. My code is:

Dim rng1 As Range
Set rng1 =
Worksheets(varWorksheetInfoArray(0)).Cells.Find(va rWorksheetInfoArray(1),
LookIn:=xlValues)

If IsEmpty(rng1) = True Then
MsgBox ("Cannot find " & varWorksheetInfoArray(2))
End If

It worked before but now there seems to be a problem since I just get the
uninformative Syntax Error.



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
runtime error: syntax error or access violation oucsester[_2_] Excel Programming 1 May 3rd 06 05:51 PM
runtime error: syntax error or access violation oucsester Excel Programming 0 May 3rd 06 02:22 PM
variable not declared error & syntax error G. Beard Excel Programming 1 October 6th 05 09:16 PM
Syntax error. David McNally Excel Programming 3 April 28th 04 02:57 AM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 12:28 AM.

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"