Thread: Copy
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Copy

In fact, you may want to allow the user to cancel the selection:

Sub NewCopy()
dim CopyFrom as range

set copyfrom = nothing
on error resume next
Set CopyFrom = Application.InputBox(prompt:="Copy FROM?", Type:=8)
on error goto 0

if copyfrom is nothing then
exit sub 'or something else??
end if

CopyFrom.Copy
ActiveCell.PasteSpecial Paste:=xlPasteAll, operation:=xlNone

End Sub

pwz wrote:

Hi All,

Any error with the codes below? The input box is correctly popped up but
nothing or some other text is pasted.

Sub NewCopy()

Set CopyFrom = Application.InputBox(prompt:="Copy FROM?", Type:=8)
Range(CopyFrom).Copy
ActiveCell.PasteSpecial Paste:=xlPasteAll, operation:=xlNone

End Sub

Thanks in advance!

pwz


--

Dave Peterson