Macro Pastes  to Cell with focus

Posted on 2011-05-01
Last Modified: 2012-05-11
Excel VBA Macro is pasting to the cell with focus rather than
the Cell selected. I need it pasted to cell B15. How do I overcome a user changing focus
   Cells(15, 2).Select

Open in new window

Question by:llawrenceg
    LVL 12

    Expert Comment

    Try this (substituting for your code fragment):

       ThisWorkbook.Sheets(1).Cells(15, 2).Paste

    Open in new window

    LVL 12

    Accepted Solution

    Sorry, forgot to amend the end too:

      ThisWorkbook.Sheets(1).Cells(15, 2).PasteSpecial xlPasteValues

    Open in new window


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
    Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now