+ Reply to Thread
Results 1 to 4 of 4

Paste transpose from existing macro

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-21-2007
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    389

    Paste transpose from existing macro

    Hello,

    As per the below macro ('see my comments in it) I would need to copy a range and paste (transpose) it into another worksheet.

    Could you please review the code and tell me if it is possible? I try to cell by cell but got a bug here: For l = 2 To lastrow. (I can add that macro too if needed)

    HTML Code: 
    Thanks,
    Graig

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Paste transpose from existing macro

    Maybe:

    Sub graiggorizz()
    Dim LOGFU As String
    Dim NAMEFU As String
    Dim TWENTY As String
    Dim TWENTY1 As String
    Dim TWENTY2 As String
    Dim TWENTY4 As String
    Dim HUNDRED As String
    Dim FORTY3 As String
    Dim FORTY7 As String
    Dim FORTY8 As String
    Dim FIFTY5 As String
    Dim SIXTY2 As String
    Dim ws As Worksheet
    Dim l As Long
    Dim Lastrow As Long
    
    Set ws = Worksheets("Followup2")
    
    ws.Activate
    Lastrow = Cells(Rows.count, 1).End(xlUp).Row
    For l = 2 To Lastrow
    Next l
    If l = Lastrow + 1 Then
      dernierID = Cells(l - 1, 1)
      Cells(l, 1).Value = dernierID + 1
    End If
    Worksheets("Followup").Range("LOGFU").Copy
    ws.Cells(l, 2).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("NAMEFU").Copy
    ws.Cells(l, 3).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("TWENTY").Copy
    ws.Cells(l, 4).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("TWENTY1").Copy
    ws.Cells(l, 5).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("TWENTY2").Copy
    ws.Cells(l, 6).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("TWENTY4").Copy
    ws.Cells(l, 7).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("HUNDRED").Copy
    ws.Cells(l, 8).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("FORTY3").Copy
    ws.Cells(l, 9).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("FORTY7").Copy
    ws.Cells(l, 10).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("FORTY8").Copy
    ws.Cells(l, 11).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("FIFTY5").Copy
    ws.Cells(l, 12).PasteSpecial xlPasteAll, Transpose = True
    Worksheets("Followup").Range("SIXTY2").Copy
    ws.Cells(l, 13).PasteSpecial xlPasteAll, Transpose = True
    
    End Sub

  3. #3
    Forum Contributor
    Join Date
    02-21-2007
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    389

    Re: Paste transpose from existing macro

    I got a error in that line:

    The source cells are in the worksheet "Followup" and the destination worksheet "Followup2". For the cells (LOGFU, NAMEFU, TWENTY, TWENTY1, TWENTY2, TWENTY4, HUNDRED, FORTY3, FORTY7, FORTY8, FIFTY5, SIXTY2 ) I donot need a transpose. Only for the range "SCHEMA".

    In fact, I do not see the range SCHEMA in your macro.

    HTML Code: 

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Paste transpose from existing macro

    Sorry I didn't read your Thread carefully and got it mixed up with a previous one.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 11
    Last Post: 11-04-2013, 04:32 PM
  2. Replies: 3
    Last Post: 10-14-2013, 03:06 PM
  3. Creating a macro to paste value and transpose
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2013, 03:39 PM
  4. Modify existing macro to transpose results
    By Cody1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2013, 09:29 AM
  5. Replies: 1
    Last Post: 10-17-2005, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1