Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
SVCNaRng below contains two cells with constant values, AND 1 cell with a null value, and I can't figure why. The 1st code snippet below has worked in other procs. uPrm is a record with row and column# parms and cell addresses, these values are good. MiscRng is 1 column, rows 17 thru 33. Some cells are locked and some are not. NO locked cells have data. SVCNaRng correctly contains the cells in rows 17 and 18 with data(each has "Last,First" string name data). It also contains the row 21 cell which is null. When I built my own loop, 2nd code snippet, I get the results I expect ??? So, what's up with specialcells and constants ? Thanks 'snippet 1 Set MiscRng = Ws.Range(Ws.Cells(uPrm.ColHdrRow + 1, uPrm.uCol.SubNa), _ Ws.Cells(uPrm.uRng.PaEndRow.Value, uPrm.uCol.SubNa)) Call unprotect_std(Ws) On Error Resume Next Set SVCNaRng = MiscRng.SpecialCells(xlCellTypeConstants) Err.Clear If Not SVCNaRng is Nothing Then ..... 'snippet 2, workaround loop below works FINE, Set SVCNaRng = Nothing For Each OneCell In MiscRng If OneCell.Value < "" Then If SVCNaRng Is Nothing Then Set SVCNaRng = OneCell Else Set SVCNaRng = Union(SVCNaRng, OneCell) End If End If Next OneCell -- Neal Z |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a guess, but probably the culprit is th unprotect_std macro.
"Neal Zimm" wrote in message ... Hi All, SVCNaRng below contains two cells with constant values, AND 1 cell with a null value, and I can't figure why. The 1st code snippet below has worked in other procs. uPrm is a record with row and column# parms and cell addresses, these values are good. MiscRng is 1 column, rows 17 thru 33. Some cells are locked and some are not. NO locked cells have data. SVCNaRng correctly contains the cells in rows 17 and 18 with data(each has "Last,First" string name data). It also contains the row 21 cell which is null. When I built my own loop, 2nd code snippet, I get the results I expect ??? So, what's up with specialcells and constants ? Thanks 'snippet 1 Set MiscRng = Ws.Range(Ws.Cells(uPrm.ColHdrRow + 1, uPrm.uCol.SubNa), _ Ws.Cells(uPrm.uRng.PaEndRow.Value, uPrm.uCol.SubNa)) Call unprotect_std(Ws) On Error Resume Next Set SVCNaRng = MiscRng.SpecialCells(xlCellTypeConstants) Err.Clear If Not SVCNaRng is Nothing Then ..... 'snippet 2, workaround loop below works FINE, Set SVCNaRng = Nothing For Each OneCell In MiscRng If OneCell.Value < "" Then If SVCNaRng Is Nothing Then Set SVCNaRng = OneCell Else Set SVCNaRng = Union(SVCNaRng, OneCell) End If End If Next OneCell -- Neal Z |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kind of a bad guess, JLG, the reason it's there is that I got a 1004 error
without it saying the specialcells needed an UNprotected sheet. Thanks. -- Neal Z "JLGWhiz" wrote: Just a guess, but probably the culprit is th unprotect_std macro. "Neal Zimm" wrote in message ... Hi All, SVCNaRng below contains two cells with constant values, AND 1 cell with a null value, and I can't figure why. The 1st code snippet below has worked in other procs. uPrm is a record with row and column# parms and cell addresses, these values are good. MiscRng is 1 column, rows 17 thru 33. Some cells are locked and some are not. NO locked cells have data. SVCNaRng correctly contains the cells in rows 17 and 18 with data(each has "Last,First" string name data). It also contains the row 21 cell which is null. When I built my own loop, 2nd code snippet, I get the results I expect ??? So, what's up with specialcells and constants ? Thanks 'snippet 1 Set MiscRng = Ws.Range(Ws.Cells(uPrm.ColHdrRow + 1, uPrm.uCol.SubNa), _ Ws.Cells(uPrm.uRng.PaEndRow.Value, uPrm.uCol.SubNa)) Call unprotect_std(Ws) On Error Resume Next Set SVCNaRng = MiscRng.SpecialCells(xlCellTypeConstants) Err.Clear If Not SVCNaRng is Nothing Then ..... 'snippet 2, workaround loop below works FINE, Set SVCNaRng = Nothing For Each OneCell In MiscRng If OneCell.Value < "" Then If SVCNaRng Is Nothing Then Set SVCNaRng = OneCell Else Set SVCNaRng = Union(SVCNaRng, OneCell) End If End If Next OneCell -- Neal Z . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Failed to save table attributes of (null) into (null). | Excel Discussion (Misc queries) | |||
How are these uses of SpecialCells different? | Excel Programming | |||
SpecialCells help | Excel Programming | |||
Null, "null", vbNull, vbNullString, vbEmpty | Excel Programming | |||
SpecialCells | Excel Programming |