Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default copy from worksheet

Having the name of a worksheet in cell A1, I would like to extract
non-contiguous data from the sheet of that name and paste it onto my "Data
temp" sheet.
How can I get the data to extract from the named sheet onto the Data Temp
sheet?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default copy from worksheet

Sub move_it()
Dim ws As Worksheet
Set ws = Sheets(Range("A1").Value)
s = Array("B1", "Z1")
For i = LBound(s) To UBound(s)
ws.Range(s(i)).Copy Sheets("Data temp").Range(s(i))
Next
End Sub

Note that s is a string array that the contains the disjoint range to be
copied.
--
Gary''s Student - gsnu200722

  #4   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default copy from worksheet

Works just as I had hoped!
Much appreciated Gary.

"Gary''s Student" wrote:

Sub move_it()
Dim ws As Worksheet
Set ws = Sheets(Range("A1").Value)
s = Array("B1", "Z1")
For i = LBound(s) To UBound(s)
ws.Range(s(i)).Copy Sheets("Data temp").Range(s(i))
Next
End Sub

Note that s is a string array that the contains the disjoint range to be
copied.
--
Gary''s Student - gsnu200722

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
Copy & paste cells fr open worksheet then close the worksheet Sin Excel Programming 1 October 2nd 06 02:20 PM
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 lukerush Excel Worksheet Functions 2 September 7th 06 05:05 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_2_] Excel Programming 2 September 22nd 04 03:30 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_3_] Excel Programming 0 September 22nd 04 03:26 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"