Copy a range with application.inputbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi folks

i got this sub that copy a cell or a range from 1 place to another
in the same sheet, but if i fx. copy a cell with the formula =SUM(A1:A3)
then the destinations copy show exatly the same =SUM(A1:A3)
and thats just what i want but here the problem :

How do i change the kode so i can copy from 1 sheet to another ?

Sub xCopy()

Set x = Application.InputBox(prompt:="Select a cell", Type:=8)
Set y = Application.InputBox(prompt:="Select a cell", Type:=8)

Range(y.Address) = x.Formula

End Sub

thanks in advance for any help.
 
Sub xCopy()

Set x = Application.InputBox(prompt:="Select a cell", Type:=8)
Set y = Application.InputBox(prompt:="Select a cell", Type:=8)

y.copy _
destination:=x

End Sub

(With no validity checks)
 
Sub xCopy()

Set x = Application.InputBox(prompt:="Select a cell", Type:=8)
Set y = Application.InputBox(prompt:="Select a cell", Type:=8)

y.Formula = x.Formula

End Sub

answer the inputboxes via mouse clicks.


Your method
Range(y.address)
hides the parent, so excel does not know which sheet you are referring to
 
thanks both for reply

Gary had what i need


"Gary''s Student" skrev:
 

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