Consulting

Results 1 to 3 of 3

Thread: Paste / Special / Transpose Code

  1. #1

    Paste / Special / Transpose Code

    Do you have any idea why this code would not work? it stops before the paste step. Thank you for your help . . .

    Marco.-
    Sub post_note_in_journal()
    '
    ' post_note_in_journal Macro
    '
    '
    Range("G8:G23").Select
    Selection.Copy
    Sheets("NOTE JOURNAL FOR TEST").Select
    Range("E3").Select
    Application.SendKeys "^{DOWN}", Wait
    Application.SendKeys "{DOWN}", Wait


    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=True
    Application.SendKeys "{HOME}", Wait

    End Sub

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    The problem is here: Application.SendKeys "^{DOWN}", Wait

    'Wait' is the name of the argument, it needs a True or False (False by default).

    I'm afraid I have to turn in for a few hours sleep, but if you would say why you are using sendkeys to Ctrl+Dn Arrow twice, I bet someone will offer a better way.

    Have a great day,

    Mark

    Edit: Criminys, when did my fingers decide to protest?

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [vba]Sub post_note_in_journal()
    Range("G8:G23").Copy
    Sheets("NOTE JOURNAL FOR TEST").Range("E3").End(xlDown).Offset(1). _
    PasteSpecial Paste:=xlPasteValues, Transpose:=True
    End Sub
    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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