PC Review


Reply
Thread Tools Rate Thread

Copy range from one open workbook's worksheet to another.

 
 
J.W. Aldridge
Guest
Posts: n/a
 
      19th May 2009
Check to see if a workbook entitled "All_to_One...." is open.
("..." represents other miscellaneous wording).

If open, select 1st worksheet in this workbook. (Will only be one
worksheet in workbook.)

Copy this range.
Range("a4:f4").Select
Range(Selection, Selection.End(xlDown)).Select

Go to workbook entitled "Apples and oranges"
Go to sheet "blueberries"
Paste at range a4:f4.
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      19th May 2009
Set DestSht = Workbooks("Apples and oranges") _
.Sheets("blueberries")
For Each bk In Workbooks
If UCase(bk.Name) = "ALL_TO_ONE...." Then
LastRow = bk.Range("A4").End(xlDown).Row
bk.Range("B4:F" & LastRow).Copy _
Destination:=DestSht.Range("A4")
Exit For
End If
Next bk

"J.W. Aldridge" wrote:

> Check to see if a workbook entitled "All_to_One...." is open.
> ("..." represents other miscellaneous wording).
>
> If open, select 1st worksheet in this workbook. (Will only be one
> worksheet in workbook.)
>
> Copy this range.
> Range("a4:f4").Select
> Range(Selection, Selection.End(xlDown)).Select
>
> Go to workbook entitled "Apples and oranges"
> Go to sheet "blueberries"
> Paste at range a4:f4.
>

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      19th May 2009
I forgot to include a sheet reference in the All_toOne workbook

Set DestSht = Workbooks("Apples and oranges") _
.Sheets("blueberries")
For Each bk In Workbooks
If UCase(bk.Name) = "ALL_TO_ONE...." Then
With bk.Sheets(1)
LastRow = .Range("A4").End(xlDown).Row
.Range("B4:F" & LastRow).Copy _
Destination:=DestSht.Range("A4")
Exit For
End If
Next bk

"J.W. Aldridge" wrote:

> Check to see if a workbook entitled "All_to_One...." is open.
> ("..." represents other miscellaneous wording).
>
> If open, select 1st worksheet in this workbook. (Will only be one
> worksheet in workbook.)
>
> Copy this range.
> Range("a4:f4").Select
> Range(Selection, Selection.End(xlDown)).Select
>
> Go to workbook entitled "Apples and oranges"
> Go to sheet "blueberries"
> Paste at range a4:f4.
>

 
Reply With Quote
 
J.W. Aldridge
Guest
Posts: n/a
 
      19th May 2009
the latter part of the workbook name changes.
Is this the correct way to say that in this code?

"ALL_TO_ONE*"
 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      19th May 2009
you've already got another thread re this

however for exact likes you'd use "=" but where the sheet names begin the
same but end differently, then yes, the aterisk is the 'any character'
symbol and you use it with the 'LIKE' condition

as given in Rick Rothstein's reply to your "Search Open Workbooks..."
question

so

IF mytext LIKE "ABC*" THEN

END IF

would be true for text string starting with "ABC" such ABCD and ABCFG





"J.W. Aldridge" <(E-Mail Removed)> wrote in message
news:785b741b-daae-4784-9108-(E-Mail Removed)...
> the latter part of the workbook name changes.
> Is this the correct way to say that in this code?
>
> "ALL_TO_ONE*"


 
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
Copy Range from Open Workbook to Active Workbook Forgone Microsoft Excel Programming 0 17th Jul 2009 01:46 AM
Copy Worksheet from one open workbook to another... =?Utf-8?B?c29wcmFub2lhbQ==?= Microsoft Excel Worksheet Functions 0 17th Aug 2007 05:12 PM
copy range from each worksheet to seperate workbook Kieran1028 Microsoft Excel Programming 0 11th Nov 2004 04:18 AM
copy range from each worksheet to seperate workbook Kieran1028 Microsoft Excel Programming 0 11th Nov 2004 04:00 AM
copy range from each worksheet to seperate workbook Kieran1028 Microsoft Excel Programming 0 11th Nov 2004 02:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:20 AM.