Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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.... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
With block does not work on inactive worksheet?
You have to qualify all objects
With ws.Range(ws.Cells(1, 1), ws.Cells(1, colCount)) Set c = .Find("C", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True) '....... End With -- HTH Bob Phillips "Vik" wrote in message ... 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.... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I email an inactive copy of a worksheet | Excel Discussion (Misc queries) | |||
how to delete the little red arrow in excell work sheet block | Excel Worksheet Functions | |||
Assign Range - Inactive Worksheet | Excel Programming | |||
Can I freeze pane on an inactive worksheet? | Excel Programming | |||
How to get the activecell of inactive worksheet ? | Excel Programming |