View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Runtime Error 91 Object variable or With block variable not set.

or even

Set rHeader = Range(pWorksheet.Cells(1, 1), pWorksheet.Cells(1,
iColCount))


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"merjet" wrote in message
...
I suspect your problem is this line:
rHeader = pWorksheet.Range(Cells(1, 1), Cells(1, iColCount))

Try this:
Set rHeader = pWorksheet.Range(Cells(1, 1), Cells(1, iColCount))

since rHeader is a Range object.

Hth,
Merjet