View Single Post
 
Old 04-19-2018, 07:50 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Code:
Sub CopySelectedRange()

On Error Resume Next    'incase input box canceled
Set rng = Application.InputBox("Use the mouse to select the range to copy", Type:=8)
    If rng Is Nothing Then Exit Sub
Set PasteHere = Application.InputBox("Use the mouse to select the upper left cell for the paste", Type:=8)
    If PasteHere Is Nothing Then Exit Sub
On Error GoTo 0         'turn error notification back on

For Each cel In rng
    If cel.Value <> "" Then
        PasteHere.Offset(i, j) = cel.Value
        j = j + 1
        If j = 2 Then
            j = 0
            i = i + 1
        End If
    End If
Next cel

End Sub
Reply With Quote