+ Reply to Thread
Results 1 to 12 of 12

Copy paste specific row of data based on user input

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    montreal
    MS-Off Ver
    Excel 2012
    Posts
    27

    Copy paste specific row of data based on user input

    Hello,

    I am new to VBA and I need to copy and paste the specific dates from the specific city that the user will insert in the "dash" sheet.
    Basically, I need the macro to read the city and range of dates that the user will type into the "dash" sheet and copy the columns "AA" to "AD" from rows specified by the dates input. Once it has been copied, it has to be special pasted just the value onto the sheet "1" beginning at location B2.

    Please note, the the data will not be available as it is vlookups to another excel sheet that i have not provided. I have deleted the data, but you can pretty much put 1's everywhere.

    Thank you very much!
    Attached Files Attached Files

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy paste specific row of data based on user input

    Maybe
    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    montreal
    MS-Off Ver
    Excel 2012
    Posts
    27

    Re: Copy paste specific row of data based on user input

    Hi Solus,

    Thank you so much for the quick reply. I have put this code in but it does not seem to work. Is there a specific format that I need to type for the dates to work? There is also seems to be an error in the line .Range(Cells(rng1.Row, "AA"), Cells(rng2.Row, "AD")).Copy

    thank you so much for your time!

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy paste specific row of data based on user input

    Where did you place the code?

    Can you attach the workbook with code in place?

    To attach a workbook, click the 'Go Advanced' button below and use the paperclip in the toolbar to navigate to your document.

  5. #5
    Registered User
    Join Date
    04-14-2014
    Location
    montreal
    MS-Off Ver
    Excel 2012
    Posts
    27

    Re: Copy paste specific row of data based on user input

    Hi Solus,


    It now works! However, is there anyway for the macro to work starting from the "dash" sheet? It seems to only work when you place it on the given sheet"city" and run the macro. The reason i ask is because I want to put a button on the "dash' sheet, and link it to your macro.

    Thank you so much!

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy paste specific row of data based on user input

    It is designed to work from the Sheet "Dash" but you don't have to put it in the code module for that sheet. Right click the tab "Dash" and click view code. Copy the code to the module shown.

  7. #7
    Registered User
    Join Date
    04-14-2014
    Location
    montreal
    MS-Off Ver
    Excel 2012
    Posts
    27

    Re: Copy paste specific row of data based on user input

    Here it is...when i run it, it only seems to work when i am on the specific city...If i am on the dash, I get an error....
    Attached Files Attached Files

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy paste specific row of data based on user input

    I found some missing .


    I will reformulate.
    Last edited by Solus Rankin; 04-15-2014 at 01:22 PM.

  9. #9
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy paste specific row of data based on user input


  10. #10
    Registered User
    Join Date
    04-14-2014
    Location
    montreal
    MS-Off Ver
    Excel 2012
    Posts
    27

    Re: Copy paste specific row of data based on user input

    Thank you!

  11. #11
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Copy paste specific row of data based on user input

    Glad to help.

    Thanks for the rep. If you are happy with the solution please mark the thread as [SOLVED] using the thread tools at the top.

  12. #12
    Registered User
    Join Date
    04-14-2014
    Location
    montreal
    MS-Off Ver
    Excel 2012
    Posts
    27

    Re: Copy paste specific row of data based on user input

    Hello again

    I was playing around with your code, but cannot see to figure it out. It seems to copy column B to column AD. Is there anyway it copies from column B to column CA? I have to add more raw data that takes up more columns.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA - Copy and Paste data based on two criteria to specific start row and column
    By ndgo10 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-02-2014, 09:15 AM
  2. Replies: 6
    Last Post: 01-29-2013, 07:01 AM
  3. [SOLVED] Macro - Copy and Paste to a Specific Row based on the input in a cell
    By usc1382 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2012, 05:05 PM
  4. Copy cell data from workbook based on user input
    By Michael A in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-31-2005, 11:10 AM

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