PC Review


Reply
Thread Tools Rate Thread

Activate macro in another book

 
 
Steve Wallis
Guest
Posts: n/a
 
      6th Jul 2008
Hi,

This is very much a work in progress and I'm sure my level of expertise will
be readily apparent.

Two problems occur. First when I copy to the 2nd workbook, the column width
is different (hence the "Autofit"). Secondly when I do my first group of
filters in book 2, it shows the correct rows, but hides all other rows down
to 65,450. I could live with that, but I want to do further sets of filters
and I run out of rows.

Any help gratefully received.

Steve W

Sub CopyTodays()

'This Sets Autofilter to select todays entries only from book 1, then copies
to book 2,then filters that data(3 different ways)and copies to another
sheet in book 2


Sheets("All").Select
Selection.AutoFilter field:=1, Criteria1:=Date
Cells.Select
Selection.Copy
Workbooks.Open "C:\Documents and Settings\Steve\My
Documents\Folder1\Folder2\Book2.xls"
Sheets("All").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Cells.EntireColumn.AutoFit
Cells.Select
Selection.AutoFilter field:=6, Criteria1:=">=40", Operator:=xlAnd
Selection.AutoFilter field:=9, Criteria1:="<14", Operator:=xlAnd
Selection.AutoFilter field:=15, Criteria1:="1"
Selection.Copy
Sheets("Test list").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("All").Select
-More Filters.......
End Sub



 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      6th Jul 2008
Hi Steve

You can use Paste special to also copy the column width
See the example here
http://www.rondebruin.nl/copy5.htm

I not understand the second question

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Steve Wallis" <(E-Mail Removed)> wrote in message news:%E%bk.17552$(E-Mail Removed)...
> Hi,
>
> This is very much a work in progress and I'm sure my level of expertise will
> be readily apparent.
>
> Two problems occur. First when I copy to the 2nd workbook, the column width
> is different (hence the "Autofit"). Secondly when I do my first group of
> filters in book 2, it shows the correct rows, but hides all other rows down
> to 65,450. I could live with that, but I want to do further sets of filters
> and I run out of rows.
>
> Any help gratefully received.
>
> Steve W
>
> Sub CopyTodays()
>
> 'This Sets Autofilter to select todays entries only from book 1, then copies
> to book 2,then filters that data(3 different ways)and copies to another
> sheet in book 2
>
>
> Sheets("All").Select
> Selection.AutoFilter field:=1, Criteria1:=Date
> Cells.Select
> Selection.Copy
> Workbooks.Open "C:\Documents and Settings\Steve\My
> Documents\Folder1\Folder2\Book2.xls"
> Sheets("All").Select
> ActiveSheet.Paste
> Application.CutCopyMode = False
> Cells.EntireColumn.AutoFit
> Cells.Select
> Selection.AutoFilter field:=6, Criteria1:=">=40", Operator:=xlAnd
> Selection.AutoFilter field:=9, Criteria1:="<14", Operator:=xlAnd
> Selection.AutoFilter field:=15, Criteria1:="1"
> Selection.Copy
> Sheets("Test list").Select
> ActiveSheet.Paste
> Application.CutCopyMode = False
> Sheets("All").Select
> -More Filters.......
> End Sub
>
>
>

 
Reply With Quote
 
Steve Wallis
Guest
Posts: n/a
 
      7th Jul 2008
Thanks for the answer Ron

In regard to the second Question, I may copy, say, 30 rows from book 1 to
book 2, then apply the filter in book 2. Normally you would see rows that I
filtered by, with other rows hidden, then see rows from 31 on visible. In
this case, it filters the data rows correctly, but hides rows 31 - 65,449.
65,450 is the next visible row after the filtered data.

Hope this clarifies. I will appreciate any help.

Steve


"Ron de Bruin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Steve
>
> You can use Paste special to also copy the column width
> See the example here
> http://www.rondebruin.nl/copy5.htm
>
> I not understand the second question
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Steve Wallis" <(E-Mail Removed)> wrote in message
> news:%E%bk.17552$(E-Mail Removed)...
>> Hi,
>>
>> This is very much a work in progress and I'm sure my level of expertise
>> will
>> be readily apparent.
>>
>> Two problems occur. First when I copy to the 2nd workbook, the column
>> width
>> is different (hence the "Autofit"). Secondly when I do my first group of
>> filters in book 2, it shows the correct rows, but hides all other rows
>> down
>> to 65,450. I could live with that, but I want to do further sets of
>> filters
>> and I run out of rows.
>>
>> Any help gratefully received.
>>
>> Steve W
>>
>> Sub CopyTodays()
>>
>> 'This Sets Autofilter to select todays entries only from book 1, then
>> copies
>> to book 2,then filters that data(3 different ways)and copies to another
>> sheet in book 2
>>
>>
>> Sheets("All").Select
>> Selection.AutoFilter field:=1, Criteria1:=Date
>> Cells.Select
>> Selection.Copy
>> Workbooks.Open "C:\Documents and Settings\Steve\My
>> Documents\Folder1\Folder2\Book2.xls"
>> Sheets("All").Select
>> ActiveSheet.Paste
>> Application.CutCopyMode = False
>> Cells.EntireColumn.AutoFit
>> Cells.Select
>> Selection.AutoFilter field:=6, Criteria1:=">=40", Operator:=xlAnd
>> Selection.AutoFilter field:=9, Criteria1:="<14", Operator:=xlAnd
>> Selection.AutoFilter field:=15, Criteria1:="1"
>> Selection.Copy
>> Sheets("Test list").Select
>> ActiveSheet.Paste
>> Application.CutCopyMode = False
>> Sheets("All").Select
>> -More Filters.......
>> End Sub
>>
>>


 
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
dialog box to activate address book for email is grayed out and n. EchoAlpha Microsoft Outlook Contacts 1 2nd Mar 2010 11:17 AM
Unable to activate address book Mary Microsoft Outlook Discussion 1 3rd Nov 2008 03:06 AM
Activate one Book then another Book lopina Microsoft Excel Programming 1 6th Jan 2008 02:10 PM
Worksheet Activate event if only one sheet in book KD Trader Microsoft Excel Programming 3 14th Mar 2007 03:20 PM
search all sheets in book to find value and activate sheet with va =?Utf-8?B?TmlnZWw=?= Microsoft Excel Programming 3 22nd Nov 2005 08:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:36 PM.