View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Identifying cell types in column using .SpecialCells(xlConstants,xlNumbers)

Another guess: Your code is behind a worksheet and the unqualified range
references belong to the sheet that owns the code--not the newly added
worksheet:

Instead of:
Set tempCellRange = Worksheets(toBeSpecdName).Range(Cells(rowStartPos, _
colStartPos), Cells(rowEndPos, colStartPos))

Try:

with worksheets(tobespecdname)
set tempcellrange = .range(.cells(rowstartpos,colstartpos), _
.cells(rowendpos,colstartpos))
end with

(watch for typos!)

And notice the dots. That means that thing belongs to the previous With's
object (in this case worksheets(tobespecdname).



"robbinma <" wrote:

Hmm.

The command worked ok before the add worksheet and failed afterwards
without any changes to the variables.

I have just found the varType function and this does what I wanted on a
cell level. I wanted to use the Special Cells on a column but the
problem can be solved at a cell level although it will take a bit
longer to run.

Thanks,

Mark

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson