OzGrid

How to pause a macro to allow user to select a cell

< Back to Search results

 Category: [Excel]  Demo Available 

How to pause a macro to allow user to select a cell

 

Requirement:

 

The user needing to copy a range of data from one workbook to another. The copying part is easy, but for pasting, the user needs to pause the macro, ask the user to select the top left cell for pasting the data. Then the macro will paste the data that has been copied using the top left cell selected by the user. How does the user allow the user to select a cell and have that cell then be used as the place for pasting (the user needs to paste VALUES due to formatting differences).

 

https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1193392-pause-macro-to-allow-user-to-select-a-cell

 

Solution:

 

If you are interested in the Paste portion ...

You could test the following :

Code:
Sub PasteMacro()
Dim answ As Variant
    On Error Resume Next
    Set answ = Application.InputBox(Prompt:="Please select a destination Cell where you want to paste", Type:=8)
    On Error GoTo 0
    If Not answ Is Nothing Then
        Selection.Copy
        answ.PasteSpecial Paste:=xlPasteValues
    End If
    Application.CutCopyMode = xlCut
End Sub

 

Obtained from the OzGrid Help Forum.

Solution provided by Carim.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to custom filter using a macro
How to use a macro to find value in a range of cells and combine values
How to create a macro for saving copy as csv with incremental file number
Macro to insert new row at bottom of table, find highest value in column A and add 1

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)