View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Worksheet name with space problem

Does excel crash when you create a small test workbook.

This didn't crash xl2003 for me:

Option Explicit
Sub testme01()

Dim wks1 As Worksheet
Dim wks2 As Worksheet

On Error Resume Next
Application.DisplayAlerts = False
Worksheets("name with space1").Delete
Worksheets("name with space2").Delete
Application.DisplayAlerts = True
On Error GoTo 0

Set wks1 = Worksheets.Add
With wks1
.Name = "name with space1"
.Range("a1").Value = "header"
.Range("a2:a10").Formula = "=""A""&mod(row(),3)"
End With

Set wks2 = Worksheets.Add
wks2.Name = "Name with space2"

wks1.Range("a1:A10").AdvancedFilter _
action:=xlFilterCopy, _
copytorange:=wks2.Range("a1"), _
unique:=True

End Sub



wrote:

Doing an advanced filter on a worksheet with a space in the worksheet name
causes it to crash even if using a variable such as
ws.range(somerange).advancedfilter.

Anyone know what causes it or work around?

Thanks


--

Dave Peterson