PC Review


Reply
Thread Tools Rate Thread

Activate woorkbook

 
 
lopina
Guest
Posts: n/a
 
      4th Jan 2008
Hi to all!!!

I have two woorkbook opened.
Book1 and Book_cup.
I need to activate Book_cup from Book1 and copy some data with code.
Book_cup change name everyday but is allvays finished with word "cup".

regards
lopina


 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      4th Jan 2008
One way:

Dim wb As Workbook

For Each wb In Workbooks
If wb.Name Like "*cup.xls" Then
With wb.Sheets(1).Range("A1:J100")
ThisWorkbook.Sheets(1).Range("B2").Resize( _
.Rows.Count, .Columns.Count).Value = .Value
End With
Exit For
End If
Next wb

Note that there's no need to activate if you work with range objects
directly.

In article <flljd6$c5o$(E-Mail Removed)>,
"lopina" <(E-Mail Removed)> wrote:

> Hi to all!!!
>
> I have two woorkbook opened.
> Book1 and Book_cup.
> I need to activate Book_cup from Book1 and copy some data with code.
> Book_cup change name everyday but is allvays finished with word "cup".
>
> regards
> lopina

 
Reply With Quote
 
lopina
Guest
Posts: n/a
 
      4th Jan 2008
Thanks

It is working

regards
lopina

"JE McGimpsey" <(E-Mail Removed)> wrote in message
news:jemcgimpsey-(E-Mail Removed)...
> One way:
>
> Dim wb As Workbook
>
> For Each wb In Workbooks
> If wb.Name Like "*cup.xls" Then
> With wb.Sheets(1).Range("A1:J100")
> ThisWorkbook.Sheets(1).Range("B2").Resize( _
> .Rows.Count, .Columns.Count).Value = .Value
> End With
> Exit For
> End If
> Next wb
>
> Note that there's no need to activate if you work with range objects
> directly.
>
> In article <flljd6$c5o$(E-Mail Removed)>,
> "lopina" <(E-Mail Removed)> wrote:
>
>> Hi to all!!!
>>
>> I have two woorkbook opened.
>> Book1 and Book_cup.
>> I need to activate Book_cup from Book1 and copy some data with code.
>> Book_cup change name everyday but is allvays finished with word "cup".
>>
>> regards
>> lopina



 
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
Printing entire woorkbook Dave Microsoft Excel Misc 2 13th Mar 2008 01:32 PM
Woorkbook toolbar Question Boy Microsoft Excel Misc 2 21st Feb 2008 05:19 PM
Opening a excel woorkbook from VBA reachkars Microsoft Excel Programming 2 30th Nov 2006 10:24 AM
woorkbook =?Utf-8?B?RXh4YWxpcw==?= Microsoft Excel Worksheet Functions 1 19th Aug 2005 12:13 PM
vlookup woorkbook anna Microsoft Excel Worksheet Functions 1 8th Oct 2003 09:47 PM


Features
 

Advertising
 

Newsgroups
 


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