View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
broro183[_11_] broro183[_11_] is offline
external usenet poster
 
Posts: 1
Default imitating cut and paste


Hi Ben,
This work-around is just "putting the ambulance at the bottom of the
cliff" because "#REF!" means that a formula in the area you are moving
is trying to reference something that doesn't exist once it has been
moved (eg a cell or range etc).
IMHO, a better solution would involve:
*Firstly, identifying what is causing the "#REF!" error.
A possible cause of this is that there is a reference in the copied
cells to an area in the place where you copy the cells to - when the
cells are pasted over, any formula that referred to the covered area
will include "#REF!" rather than a cell reference (eg B3). If this is
the case, your approach could be providing incorrect data.

*Secondly, is this copying/moving really needed or could the
spreadsheet layout be modified to elimnate need?
If moving is needed, try adapting the macro below to use with your
existing macro (watch out for line breaks in code below):

Sub Pk_Rng()
'sourced from
http://www.experts-exchange.com/Appl..._20629300.html

Dim prompt, sDlgTitle As String
prompt = "Select a range"
sDlgTitle = "Get User Range"
On Error Resume Next
Set URng = Application.InputBox("Select range", sDlgTitle,
ActiveCell.Address, Type:=8)
MyAddr = URng.Address
' Set Pk_Rng = URng
If URng Is Nothing Then Exit Sub
'ENTER YOUR COPY, PASTE, & DELETE CODE HERE USING THE RANGE DEFINED BY
YOUR SELECTION.
End Sub

hth,
Rob Brockett
NZ


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=499117