View Single Post
 
Old 04-20-2018, 01:02 AM
Urraco Urraco is offline Windows 8 Office 2016
Advanced Beginner
 
Join Date: Apr 2018
Posts: 30
Urraco is on a distinguished road
Default

Quote:
Originally Posted by NoSparks View Post
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
Works .Many thanks
but, if it's not much trouble, can you make a macro for 7 columns?
like in example
Attached Images
File Type: jpg cp.jpg (33.2 KB, 18 views)
Reply With Quote