View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default copy and paste multiple selection

Gareth,
If you have merged cells then you need to replace my macro with this. Please
advise if it works for you or not.

Sub TransferData()
Dim SourceRng As Range, DestRng As Range
Dim c As Range
Dim Prompt As String, Title As String, Default As String
Dim i As Integer

Prompt = "Select source range..."
Title = "Data transfer"
Default = Selection.Address
On Error Resume Next
Set SourceRng = Application.InputBox(Prompt, Title, Default, Type:=8)
If Err.Number 0 Then Exit Sub
Prompt = "Select destination cell..."
Set DestRng = Application.InputBox(Prompt, Title, Type:=8)
If Err.Number 0 Then Exit Sub
On Error GoTo 0
i = 0
Application.ScreenUpdating = False
For Each c In SourceRng.Cells
If Len(c) 0 Then
i = i + 1
DestRng(1, i) = c
End If
Next
Application.ScreenUpdating = True
End Sub

Regards,
Greg

"Gareth" wrote:

c7:c9, etc, are merged cells if that makes ant difference........

"Jim Cone" wrote in message
...
Gareth,

You can't put 10 lbs in a 5 lb bag.

There are 165 cells in...
Range("T5,C7:T9,T13,C15:T17,T19,C21:T23")
and
6 cells in...
Range("A4:F4")

Your can do this...
Sheets("Sheet2").Range("A4:F4").Value =

Sheets("Sheet1").Range("G4:L4").Value

Regards,
Jim Cone
San Francisco, USA


"Gareth" wrote in message
...
Have had a look in Help but not able to find an answer to my problem, in
fact Help says that what I want is not possible so I thought I would

turn to
the pro's.
I want to copy a selection of cells and paste them into a row on another
sheet.
An example would be to copy:

Sheets("Sheet1").Range("T5,C7:T9,T13,C15:T17,T19,C 21:T23")

and put it into A4:F4 on Sheet2

I know I can do it one cell at a time but I was hoping that I could

speed
things up and do it all in one go as the macro will be quite long.
Thanks in advance.
Gareth