Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
CopyFrom is already a range. So you don't surround it with range().
copyfrom.copy activecell.pastespecial .... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Dave,
Great thanks to your additional suggestion! The codes work excellently. "Dave Peterson" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
copy formulas from a contiguous range to a safe place and copy them back later | Excel Programming | |||
EXCEL FILE a copy/a copy/a copy ....filename | New Users to Excel | |||
Code to copy range vs Copy Entire Worksheet - can't figure it out | Excel Programming | |||
How copy format, font, color and border without copy/paste? | Excel Programming |