View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vik[_3_] Vik[_3_] is offline
external usenet poster
 
Posts: 8
Default With block does not work on inactive worksheet?

Hi All,

I have these lines inside a function -

Dim ws As Worksheet
Set ws = Sheets(SheetName)
ws.Activate
colCount = ws.UsedRange.Columns.count
With ws.Range(Cells(1, 1), Cells(1, colCount))
Set c = .Find("C", LookIn:=xlValues, LookAt:=xlWhole,
MatchCase:=True)
'.......
End With

Until ws.Activate was added, it jumped out of a function on With statement.
Weird....