PC Review


Reply
Thread Tools Rate Thread

AutoFilter selected row not 'retained' across user unselect/select

 
 
YoDave
Guest
Posts: n/a
 
      27th Oct 2008
Sorry if this is the wrong place for this, first post ever!

I'm building a tool to create a set of workbooks.
Our 'header' consists of 6 rows, mostly blank,with the column names on row
4, and the column names duplicated on row 6. Data starts in row 7.

When testing, I was able to set and file the AutoFilter programmatically on
Row 6. When I opened the books, Row 6 had the dropdowns.

When (me the user) clicked off the autofilter and clicked it back on, it set
the autofilter row to row 4?

Is there something programmatically I need to set to retain row 6 as the
AutoFilter row?

Thanks,
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      27th Oct 2008
Are you selecting the exact range you want filtered or letting excel guess.

I bet you're not selecting the exact range, then applying the filter.

YoDave wrote:
>
> Sorry if this is the wrong place for this, first post ever!
>
> I'm building a tool to create a set of workbooks.
> Our 'header' consists of 6 rows, mostly blank,with the column names on row
> 4, and the column names duplicated on row 6. Data starts in row 7.
>
> When testing, I was able to set and file the AutoFilter programmatically on
> Row 6. When I opened the books, Row 6 had the dropdowns.
>
> When (me the user) clicked off the autofilter and clicked it back on, it set
> the autofilter row to row 4?
>
> Is there something programmatically I need to set to retain row 6 as the
> AutoFilter row?
>
> Thanks,


--

Dave Peterson
 
Reply With Quote
 
YoDave
Guest
Posts: n/a
 
      28th Oct 2008
ty for response.

Range is set. I'm using

wb.open()
....
Excel.Range afRange = get_Range("A6", "E6");
afRange.AutoFilter(1, Type.Missing,
Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);
....
wb.SaveAs(newname);

So that I can reuse the template and set specifics for different workbooks.
This is working ok.
In my set of saved workbooks, when I open one, Row 6 is indeed set as the
autofilter row on each sheet. However, when I click autofilter off, then
click it back on, it loses track of row 6, and is setting row 4!

I guess my question is, ms knew what row autofilter was set on when the
workbook was opened by the user, but when the user starts playing around, the
row or range that was set is lost?

"Dave Peterson" wrote:

> Are you selecting the exact range you want filtered or letting excel guess.
>
> I bet you're not selecting the exact range, then applying the filter.
>
> YoDave wrote:
> >
> > Sorry if this is the wrong place for this, first post ever!
> >
> > I'm building a tool to create a set of workbooks.
> > Our 'header' consists of 6 rows, mostly blank,with the column names on row
> > 4, and the column names duplicated on row 6. Data starts in row 7.
> >
> > When testing, I was able to set and file the AutoFilter programmatically on
> > Row 6. When I opened the books, Row 6 had the dropdowns.
> >
> > When (me the user) clicked off the autofilter and clicked it back on, it set
> > the autofilter row to row 4?
> >
> > Is there something programmatically I need to set to retain row 6 as the
> > AutoFilter row?
> >
> > Thanks,

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Oct 2008
I'm not sure what click autofilter on and off mean. But if I'm doing things
manually, I'd select the range first.

If I'm doing it in code (VBA), I'd remove the existing filter arrows and reapply
them to the range I wanted.

With Worksheets("SomeSheetNameHere")
.autofiltermode = false
.range("a6:E6").autofilter
End with

I don't speak that stuff you're speaking <vbg>.


YoDave wrote:
>
> ty for response.
>
> Range is set. I'm using
>
> wb.open()
> ...
> Excel.Range afRange = get_Range("A6", "E6");
> afRange.AutoFilter(1, Type.Missing,
> Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);
> ...
> wb.SaveAs(newname);
>
> So that I can reuse the template and set specifics for different workbooks.
> This is working ok.
> In my set of saved workbooks, when I open one, Row 6 is indeed set as the
> autofilter row on each sheet. However, when I click autofilter off, then
> click it back on, it loses track of row 6, and is setting row 4!
>
> I guess my question is, ms knew what row autofilter was set on when the
> workbook was opened by the user, but when the user starts playing around, the
> row or range that was set is lost?
>
> "Dave Peterson" wrote:
>
> > Are you selecting the exact range you want filtered or letting excel guess.
> >
> > I bet you're not selecting the exact range, then applying the filter.
> >
> > YoDave wrote:
> > >
> > > Sorry if this is the wrong place for this, first post ever!
> > >
> > > I'm building a tool to create a set of workbooks.
> > > Our 'header' consists of 6 rows, mostly blank,with the column names on row
> > > 4, and the column names duplicated on row 6. Data starts in row 7.
> > >
> > > When testing, I was able to set and file the AutoFilter programmatically on
> > > Row 6. When I opened the books, Row 6 had the dropdowns.
> > >
> > > When (me the user) clicked off the autofilter and clicked it back on, it set
> > > the autofilter row to row 4?
> > >
> > > Is there something programmatically I need to set to retain row 6 as the
> > > AutoFilter row?
> > >
> > > Thanks,

> >
> > --
> >
> > Dave Peterson
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Cell keeps getting selected and unselect Vic Abrahamian Microsoft Excel Crashes 0 15th Nov 2008 02:54 AM
How unselect? Want to run ActiveWindow.VisibleRange but have Chartobject selected tskogstrom Microsoft Excel Programming 3 30th Sep 2006 12:56 AM
Unselect all selected areas in all sheets SiriS Microsoft Excel Misc 2 20th Jan 2006 08:36 AM
Webform: How to unselect selected listitem in listbox? mikev Microsoft Dot NET 1 10th Dec 2005 10:07 AM
How can I unselect items from multi-selected list box through VBA?? =?Utf-8?B?R2hvc3Q=?= Microsoft Access Forms 2 10th Dec 2003 05:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:19 AM.