copy from worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top