Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Test if an element of array is empty

How can I test if .aryPartDes(2) has something in it? Note: PartInfo() is a
function, where it looks up the part number "UVOvercoat", and stores a 1 x 4
Range in .aryPartDes(2). If nothing is assigned to .aryPartDes(2) then I get
an error indicated below. Any ideas?


' formetco UV overcoat material
If chkUVOvercoat.Enabled And chkUVOvercoat Then
.aryPartDes(2) = PartInfo("UVOvercoat")
.aryPartQty(2) = .TrimSqFt * Val(tbxQuantity)
End If

' must have minimum $175 order each face: material + overcoat
ERROR If .aryPartDes(2) = Empty Then
If .TrimSqFt * (.aryPartDes(1)(1, 4) + .aryPartDes(2)(1, 4)) < 175 Then
.aryPartDes(1) = PartInfo("FormetcoMinPrice")
.aryPartQty(1) = Val(tbxQuantity)

Erase .aryPartDes(2)
.aryPartQty(2) = 0
End If
Else
If .TrimSqFt * .aryPartDes(1)(1, 4) < 175 Then
.aryPartDes(1) = PartInfo("FormetcoMinPrice")
.aryPartQty(1) = Val(tbxQuantity)
End If
End If
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Test if an element of array is empty

rather than:
If .aryPartDes(2) = Empty
try:
If isempty(.aryPartDes(2))
--
Gary''s Student - gsnu200839


"Ryan H" wrote:

How can I test if .aryPartDes(2) has something in it? Note: PartInfo() is a
function, where it looks up the part number "UVOvercoat", and stores a 1 x 4
Range in .aryPartDes(2). If nothing is assigned to .aryPartDes(2) then I get
an error indicated below. Any ideas?


' formetco UV overcoat material
If chkUVOvercoat.Enabled And chkUVOvercoat Then
.aryPartDes(2) = PartInfo("UVOvercoat")
.aryPartQty(2) = .TrimSqFt * Val(tbxQuantity)
End If

' must have minimum $175 order each face: material + overcoat
ERROR If .aryPartDes(2) = Empty Then
If .TrimSqFt * (.aryPartDes(1)(1, 4) + .aryPartDes(2)(1, 4)) < 175 Then
.aryPartDes(1) = PartInfo("FormetcoMinPrice")
.aryPartQty(1) = Val(tbxQuantity)

Erase .aryPartDes(2)
.aryPartQty(2) = 0
End If
Else
If .TrimSqFt * .aryPartDes(1)(1, 4) < 175 Then
.aryPartDes(1) = PartInfo("FormetcoMinPrice")
.aryPartQty(1) = Val(tbxQuantity)
End If
End If
--
Cheers,
Ryan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Test if an element of array is empty

I figured out what is was. Yes you are correct! I had tried that earlier,
but it didn't seem work correctly. It turns out I did not clear out the old
data from the array first by using the Erase method, thus my If...Then
statement wasn't working correctly.

Thanks for the help!
--
Cheers,
Ryan


"Gary''s Student" wrote:

rather than:
If .aryPartDes(2) = Empty
try:
If isempty(.aryPartDes(2))
--
Gary''s Student - gsnu200839


"Ryan H" wrote:

How can I test if .aryPartDes(2) has something in it? Note: PartInfo() is a
function, where it looks up the part number "UVOvercoat", and stores a 1 x 4
Range in .aryPartDes(2). If nothing is assigned to .aryPartDes(2) then I get
an error indicated below. Any ideas?


' formetco UV overcoat material
If chkUVOvercoat.Enabled And chkUVOvercoat Then
.aryPartDes(2) = PartInfo("UVOvercoat")
.aryPartQty(2) = .TrimSqFt * Val(tbxQuantity)
End If

' must have minimum $175 order each face: material + overcoat
ERROR If .aryPartDes(2) = Empty Then
If .TrimSqFt * (.aryPartDes(1)(1, 4) + .aryPartDes(2)(1, 4)) < 175 Then
.aryPartDes(1) = PartInfo("FormetcoMinPrice")
.aryPartQty(1) = Val(tbxQuantity)

Erase .aryPartDes(2)
.aryPartQty(2) = 0
End If
Else
If .TrimSqFt * .aryPartDes(1)(1, 4) < 175 Then
.aryPartDes(1) = PartInfo("FormetcoMinPrice")
.aryPartQty(1) = Val(tbxQuantity)
End If
End If
--
Cheers,
Ryan

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
Rules for element-by-element product in array multiplication Paul Excel Programming 2 March 22nd 08 11:42 PM
Can I test dynamic array for empty? LabElf Excel Programming 7 November 11th 05 06:04 PM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 6 November 9th 05 05:54 AM
Can't test for Empty objects in an array Peter Chatterton[_4_] Excel Programming 3 July 28th 05 07:06 AM
Set array element to empty Raul Excel Programming 2 March 2nd 05 03:53 PM


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