Paste Function in Macro

  • Thread starter Thread starter Kate
  • Start date Start date
K

Kate

Hi,
I'm setting up a macro that copies information from one
tab in a workbook, and needs to paste it to another tab.
The problem is, I need to set it up so that a pop up
appears asking what cell to paste the data to. Ex:

Copies cells A1

Asks "Where do you want the info?"

User types "C5"

Macro pastes the data to C5.

Any ideas?
 
Kate,

Use Application.Inputbox with a type of 8. Your user can then select a cell,
using the mouse.For example

Set ans = Application.InputBox("Select a cell", Type:=8)
Msgbox ans.Value

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Dim sh as worksheet
Dim rng as Range
set sh = Activesheet
On Error Resume next
set rng = Application.InputBox("Where do you want the info (select with
mouse or type in)",type:=8)
On Error goto 0
if not rng is nothing then
sh.Range("A1").Copy Destination:=rng
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top