PDA

View Full Version : RefEdit



lior03
06-19-2006, 01:27 AM
hello
i found this code in a john walkenbach book.
i am trying to use a refedit to copy a selection from a cell to another.

Dim Msg As String
Msg = "Source = " & Me.RefEdit1.Value & vbNewLine
Selection.Copy
Msg = Msg & "Destination = " & Me.RefEdit2.Value & vbNewLine
ActiveSheet.Paste
Application.CutCopyMode = False
MsgBox Msg


what wrong with this code?
thanks

lucas
06-19-2006, 06:38 AM
Hello Moshe,
This must only be part of the code....the "Me.Refedit1.value line tells me it probably belongs to a form. Can you post the rest of the code or give some more information?

lior03
06-19-2006, 10:51 PM
here is the entire file.

mdmackillop
06-20-2006, 05:55 AM
Try

Private Sub CommandButton2_Click()
Dim Msg As String
Msg = "Source = " & Me.RefEdit1.Value & vbNewLine
Msg = Msg & "Destination = " & Me.RefEdit2.Value & vbNewLine
MsgBox Msg
Range(Me.RefEdit1.Value).Copy Range(Me.RefEdit2.Value)
Unload Me
End Sub