Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2018, 03:30 AM
Urraco Urraco is offline simple copy and paste trick? Windows 8 simple copy and paste trick? Office 2016
Advanced Beginner
simple copy and paste trick?
 
Join Date: Apr 2018
Posts: 30
Urraco is on a distinguished road
Default simple copy and paste trick?

Hi
I would like to know if you can copy 6 columns and then paste it in order in 2 columns?
I have attached a picture as example


Thanks
Attached Images
File Type: jpg Untitled-3.jpg (103.8 KB, 30 views)
Reply With Quote
  #2  
Old 04-19-2018, 04:13 AM
ArviLaanemets ArviLaanemets is offline simple copy and paste trick? Windows 8 simple copy and paste trick? Office 2016
Expert
 
Join Date: May 2017
Posts: 949
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

You can't.

Or more precise - you can when you edit a table a bit at first, ant then copy and paste pair-wise (7 times for your example)
Reply With Quote
  #3  
Old 04-19-2018, 06:33 AM
NoSparks NoSparks is offline simple copy and paste trick? Windows 7 64bit simple copy and paste trick? 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

Any interest in a macro solution for this ?
Reply With Quote
  #4  
Old 04-19-2018, 06:39 AM
Urraco Urraco is offline simple copy and paste trick? Windows 8 simple copy and paste trick? Office 2016
Advanced Beginner
simple copy and paste trick?
 
Join Date: Apr 2018
Posts: 30
Urraco is on a distinguished road
Default

Quote:
Originally Posted by NoSparks View Post
Any interest in a macro solution for this ?
Of course, please
Reply With Quote
  #5  
Old 04-19-2018, 07:50 AM
NoSparks NoSparks is offline simple copy and paste trick? Windows 7 64bit simple copy and paste trick? 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
  #6  
Old 04-20-2018, 01:02 AM
Urraco Urraco is offline simple copy and paste trick? Windows 8 simple copy and paste trick? Office 2016
Advanced Beginner
simple copy and paste trick?
 
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
  #7  
Old 04-20-2018, 06:08 AM
NoSparks NoSparks is offline simple copy and paste trick? Windows 7 64bit simple copy and paste trick? 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

Try this, it asks the number of columns you want to paste to.
Code:
Sub CopySelectedRange()

    Dim rng As Range, cel As Range
    Dim PasteHere As Range, NumCols As Integer
    
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
NumCols = Application.InputBox("How many columns should be used for the paste?")
    If Not IsNumeric(NumCols) Or NumCols = 0 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 = NumCols Then
            j = 0
            i = i + 1
        End If
    End If
Next cel

End Sub
Reply With Quote
  #8  
Old 04-20-2018, 06:15 AM
Urraco Urraco is offline simple copy and paste trick? Windows 8 simple copy and paste trick? Office 2016
Advanced Beginner
simple copy and paste trick?
 
Join Date: Apr 2018
Posts: 30
Urraco is on a distinguished road
Default

[QUOTE=NoSparks;127389]Try this, it asks the number of columns you want to paste to.

That's it!
Many Thanks
Reply With Quote
  #9  
Old 04-20-2018, 06:19 AM
NoSparks NoSparks is offline simple copy and paste trick? Windows 7 64bit simple copy and paste trick? 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

You're welcome, glad I could help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
simple copy and paste trick? Simple macro to create a copy eduzs Word VBA 3 05-17-2017 05:34 PM
simple copy and paste trick? When I copy&paste a second copy appears that can't be edited makeo22 Word 3 04-26-2017 07:09 PM
simple copy and paste trick? Copy / paste BoyertownCasket Excel 4 04-19-2016 12:32 AM
simple copy and paste trick? Paste and Copy Quadro Excel 4 07-15-2014 05:59 AM
simple copy and paste trick? Paste Special: Copy and Paste Formatting Only? tinfanide Word 6 03-06-2013 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft