View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Bug in Excel 2003


the bug is not a bug.. imo your syntax is erroneous..


'Make next name with this permutation
Call addsingle(xlPnumRange.Value2(lPnumIndex, 1), _
strFormatSpec, strTcId & strTestType)



already part of some 'cumbersome' code to loop a multiarea range
this will very likely go bust..

if xlPnumRange is a 1 row, multicolumn range (may be 1 area of your
entire selection) the Value or Value2 of that range will be returned as
a 1 dimensional array.

dim v(1) = debug.print v(1,1) will produce an error.

Thus you might use:
Call addsingle(xlPnumRange.Cells(lPnumIndex, 1).Value, _
strFormatSpec, strTcId & strTestType)

Note that when enumerating ROWS inside a range you cannot abbreviate
getting the first cell of the row range like xlRow(1,1).. you must use
xlRow.Cells(1,1). To avoid confusion avoid the abbreviated syntax
altogether.


But even then I'd code your entire for each differently.

After your loop:

'Get selected cells
Set xlPnumRange = Selection

Dim xlArea As Range, xlRow As Range
For Each xlArea In xlPnumRange.Areas
For Each xlRow In xlArea.Rows
'Get good format spec
strFormatSpec = adjustformat(xlRow)
'Make next name with this permutation
Call addsingle(xlRow.Cells(1,1).Value, _
strFormatSpec, _
strTcId & strTestType)
Next
Next

Can't test but that should do the same as your code.


HTH

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


LabElf wrote :

OK, for anyone who is interested, here is the code for the AddTest
macro. It calls some other macros, and makes some assumptions about
the worksheet it is called from, but I think it should be fairly
clear.


SNIP



"keepITcool" wrote:

post your code, so we may (dis)agree or advise

--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam