Consulting

Results 1 to 4 of 4

Thread: RefEdit

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    RefEdit

    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.
    [VBA]
    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

    [/VBA]
    what wrong with this code?
    thanks
    moshe

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location
    here is the entire file.
    moshe

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Try
    [VBA]
    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

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •