Results 1 to 2 of 2

Select, copy and paste columns with InputBox

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-01-2019
    Location
    New York, New York
    MS-Off Ver
    Office 2016 for Mac
    Posts
    125

    Select, copy and paste columns with InputBox

    I am looking to select a column, copy it, and paste it on another sheet. I would like to use an inputbox so the user can submit which columns will be copied to the other worksheet (one column at a time). Thanks to anyone who can help or point me in the right direction!

    This is the code I came up with which works but it's definitely not best practices.

    Dim answer
    Dim answer2
    Dim answer3
    Dim colNum As Integer
    Dim colNum2 As Integer
    Dim colNum3 As Integer
    Dim sh As Worksheet
    Set sh = Sheets("Raw Data")
    Dim sh2 As Worksheet
    Set sh2 = Sheets("Sheet1")
    
    'Copy + paste rep names
    
    answer = InputBox("Enter Column Letter")
    colNum = Cells(1, answer).Column
    sh.Columns(colNum).Copy sh2.Range("J:J")
    
    'Copy + paste rep scores
    
    answer2 = InputBox("Enter Column Letter")
    colNum2 = Cells(1, answer2).Column
    sh.Columns(colNum2).Copy sh2.Range("K:K")
    
    
    'Copy + paste rep method or location
    
    answer3 = InputBox("Enter Column Letter")
    colNum3 = Cells(1, answer3).Column
    sh.Columns(colNum3).Copy sh2.Range("L:L")
    Last edited by Ianmacros; 07-02-2019 at 12:56 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] InputBox to Select Cell for Paste Special
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-16-2017, 10:14 PM
  2. [SOLVED] Copy last non blank entrie row and paste many time (inputbox value) to the next empty row
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2017, 10:11 AM
  3. How to Select and Copy/Paste Columns Based on Checkbox
    By krayon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2016, 05:48 PM
  4. [SOLVED] Copy range and paste using inputbox
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2014, 12:21 AM
  5. Replies: 1
    Last Post: 03-15-2014, 05:44 AM
  6. InputBox prompt user to select no more than 3 columns else error msgbox then try again
    By Littleeleven in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2013, 10:54 AM
  7. [SOLVED] Numbers in cells not recognized when using InputBox to copy and paste rows
    By Nikolette in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-25-2013, 07:09 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1