View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_16_] Steve[_16_] is offline
external usenet poster
 
Posts: 28
Default InputBox doesn't allow non adjacent rows

I have the below procedure which allows me to select a range on 1
sheet and copy each row in that range 10 times, before moving on to
the next row. The Application.InputBox method allows me to select
multiple rows if they are adjacent, but it only copies the first
selected row when the selection contains non-adjacent rows. Is there a
work around to this?

Thanks in advance for any assistance...

<-------------------------------------------------------------------------------------------------------------------------


Sub CopySelection10Times()

Dim myRange As Range
Dim rng As Range
Dim i As Long
Dim wksto As Worksheet

On Error Resume Next
Set wksto = ThisWorkbook.Sheets("Metro AHK New")
Set myRange = Application.InputBox("Select data to
copy", , , , , , , 8)

If myRange Is Nothing Then
Exit Sub
Else
End If

For i = 1 To myRange.Rows.Count
myRange.Rows(i).EntireRow.Copy wksto.Cells(wksto.Rows.Count, _
1).End(xlUp).Offset
(1, 0).Resize(10, wksto.Columns.Count)
Next

Application.CutCopyMode = False

End Sub