Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Activate woorkbook

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Activate woorkbook

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 ,
"lopina" 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Activate woorkbook

Thanks

It is working

regards
lopina

"JE McGimpsey" wrote in message
...
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 ,
"lopina" 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
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
Protect single sheets in the woorkbook Aron Excel Worksheet Functions 10 February 5th 09 12:05 AM
Printing entire woorkbook Dave Excel Discussion (Misc queries) 2 March 13th 08 01:32 PM
Woorkbook toolbar Question Boy Excel Discussion (Misc queries) 2 February 21st 08 05:19 PM
Opening a excel woorkbook from VBA reachkars Excel Programming 3 November 30th 06 10:24 AM
woorkbook Exxalis Excel Worksheet Functions 1 August 19th 05 12:13 PM


All times are GMT +1. The time now is 11:09 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"