InputBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IanFLY
    New Member
    • Jun 2007
    • 1

    #1

    InputBox

    Hi all. I'm self taught with this, please be gentle!
    I would like to write a macro which copies a set area (fine with that) and then asks the user the cell in which to paste this info - and then paste!
    Can anybody please please help before pc goes through office window??
    Cheers, Ian
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Hi, hope something like this helps.

    Code:
    Sub copypaste()
        Dim Dest(2) As Integer
        
        Range(Cells(1, 1), Cells(5, 5)).Select '<--- modify here the first range or just delete this line to use the one you already had
        Selection.Copy
        Dest(1) = InputBox("Destination cell's row", "Destination", "1")
        Dest(2) = InputBox("Destination cell's column (with number)" & Chr(10) & "A = 1" & Chr(10) & "B = 2" & Chr(10) & "...", "Destination", "1")
        Cells(Dest(1), Dest(2)).Select
        ActiveSheet.Paste
    
    End Sub
    Good Luck

    Comment

    Working...