Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Worksheet name with space problem

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Worksheet name with space problem

Go there first:

Sub Macro2()
Sheets("a a").Activate
Range("A1:C10").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"K5"), Unique:=True
End Sub

--
Gary''s Student - gsnu200746


" 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Worksheet name with space problem

Thanks for the reply.
That actually brings up a separate problem/bug documented by Microsoft. The
data is actually filtered to another worksheet which must be activated.

Sorry about leaving that out but I didn't think it was an issue since I was
handling another bug.

Is this particular bug documented somewhere?

Steve


"Gary''s Student" wrote in message
...
Go there first:

Sub Macro2()
Sheets("a a").Activate
Range("A1:C10").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"K5"), Unique:=True
End Sub

--
Gary''s Student - gsnu200746


" 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Worksheet name with space problem

I don't know if its a bug or just a limitation. I tried to manually run
Advanced Filter with the Recorder either turned on or off. Manually,
naturally, we are always on the sheet that the filter is using. When I tried
to save to a destination that was on another sheet, Excel generated an error
message saying I can't do it.
--
Gary''s Student - gsnu2007


" wrote:

Thanks for the reply.
That actually brings up a separate problem/bug documented by Microsoft. The
data is actually filtered to another worksheet which must be activated.

Sorry about leaving that out but I didn't think it was an issue since I was
handling another bug.

Is this particular bug documented somewhere?

Steve


"Gary''s Student" wrote in message
...
Go there first:

Sub Macro2()
Sheets("a a").Activate
Range("A1:C10").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"K5"), Unique:=True
End Sub

--
Gary''s Student - gsnu200746


" 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






  #5   Report Post  
Posted to microsoft.public.excel.programming
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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Worksheet name with space problem

If you start your data|filter|advanced filter on the "receiving" worksheet, it
should work ok.

Gary''s Student wrote:

I don't know if its a bug or just a limitation. I tried to manually run
Advanced Filter with the Recorder either turned on or off. Manually,
naturally, we are always on the sheet that the filter is using. When I tried
to save to a destination that was on another sheet, Excel generated an error
message saying I can't do it.
--
Gary''s Student - gsnu2007

" wrote:

Thanks for the reply.
That actually brings up a separate problem/bug documented by Microsoft. The
data is actually filtered to another worksheet which must be activated.

Sorry about leaving that out but I didn't think it was an issue since I was
handling another bug.

Is this particular bug documented somewhere?

Steve


"Gary''s Student" wrote in message
...
Go there first:

Sub Macro2()
Sheets("a a").Activate
Range("A1:C10").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"K5"), Unique:=True
End Sub

--
Gary''s Student - gsnu200746


" 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
  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Worksheet name with space problem

I don't why you are deleting the worksheets and then adding them.

I have a workbook that contains the code and worksheets for retrieving the
data.

I open up a workbook that contains a worksheet with rows and columns of data
of which one column I want to extract into the first workbook. If the data
worksheet's name has a space in it the autofilter code errors.

Right now I have added code to replace the spaces with the infamous _ but
you shouldn't have to do that unless it is a geniune bug and supposedly your
code works.

This is my code

Set wsEx = ThisWorkbook.Worksheets("ExtractData")
Set wsData = ActiveSheet 'activesheet name could be My Worksheet

wsData.Range("DataCol").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=wsEx .Range("LDExCrit"), _
CopyToRange:=wsEx .Range("ExtractCol"), Unique:=True

I notice you don't have the CriteriaRange set but that shouldn't affect it.
You also are setting the worksheet variables to the initial add worksheet
code instead of the name of the worksheet such or activesheet which could
make a difference.
I am using named ranges but that shouldn't matter either.

Steve



"Dave Peterson" wrote in message
...
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



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Worksheet name with space problem

The code I used deleted worksheets with those test names--if they existed. I
wanted to make sure that if you ran the code twice, it would not end in an error
when the renaming of the new worksheets took place.

No you shouldn't have to rename those worksheets that have spaces in their
names. You may want to try that suggested code in a new workbook to see if
works for you.

Since you haven't posted any real details, I'm guessing that the error is caused
by an error in your code--not because of the space in the worksheet name.

wrote:

I don't why you are deleting the worksheets and then adding them.

I have a workbook that contains the code and worksheets for retrieving the
data.

I open up a workbook that contains a worksheet with rows and columns of data
of which one column I want to extract into the first workbook. If the data
worksheet's name has a space in it the autofilter code errors.

Right now I have added code to replace the spaces with the infamous _ but
you shouldn't have to do that unless it is a geniune bug and supposedly your
code works.

This is my code

Set wsEx = ThisWorkbook.Worksheets("ExtractData")
Set wsData = ActiveSheet 'activesheet name could be My Worksheet

wsData.Range("DataCol").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=wsEx .Range("LDExCrit"), _
CopyToRange:=wsEx .Range("ExtractCol"), Unique:=True

I notice you don't have the CriteriaRange set but that shouldn't affect it.
You also are setting the worksheet variables to the initial add worksheet
code instead of the name of the worksheet such or activesheet which could
make a difference.
I am using named ranges but that shouldn't matter either.

Steve

"Dave Peterson" wrote in message
...
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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line space problem Bibbi Excel Discussion (Misc queries) 1 February 16th 09 10:18 PM
Import from Access, space problem Beginner Excel Discussion (Misc queries) 0 June 10th 08 01:56 PM
space problem Craig[_3_] Excel Discussion (Misc queries) 1 January 19th 08 11:57 PM
Out of stack space problem Fred Excel Programming 2 April 19th 06 01:11 PM
Out of stack space problem Fred Excel Programming 2 April 19th 06 01:10 PM


All times are GMT +1. The time now is 08:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"