+ Reply to Thread
Results 1 to 13 of 13

find the last used column and paste the rows alongside the last column.

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    find the last used column and paste the rows alongside the last column.

    I am trying to format my worksheet. I am trying write a macro that finds the last used column (in this case it is Column V) and select the rows range for each company(Column E to Column J) and paste to the Column W( next to the last used column). And finally delete the empty rows. What I need is a row for each company. I have attached the sheet. It would be nice if someone could help me on this.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: find the last used column and paste the rows alongside the last column.

    I tried with this code right now.
    Please Login or Register  to view this content.
    Now I get an error "runtime 1004 : Application defined or object defined error". I know that someone would know how to solve this issue. Thanks in advance.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: find the last used column and paste the rows alongside the last column.

    I'm not entirely sure I understand, so try on a copy first.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: find the last used column and paste the rows alongside the last column.

    Your code cuts the Column values E to J and Paste it to the Column W. But my requirement was I need rows to be copied alongside the columns starting from W. Say I need row 4 to cut and paste in to Range (W3:AB3) and row 5 to be pasted in range (AC3 : AH3) and row 6 to (AI3:AK3) like wise in the second company as well. just like the sheet 2 in the workbook attached.

  5. #5
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: find the last used column and paste the rows alongside the last column.

    Hi john, I tried writing the code to paste the rows alongside except I dont know how to paste those values starting from Column W. the snippet does that
    Please Login or Register  to view this content.
    here FoundDate is Set FoundDate = Worksheets("Sheet1").Columns(ColumnLetter) But gets an error. I am not sure if I am doing it write. it would great if you could help me.
    Last edited by mvneema; 03-19-2014 at 12:55 PM.

  6. #6
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Unhappy Re: find the last used column and paste the rows alongside the last column.

    I wrote this code that give no error but it did not meet my purpose.
    Please Login or Register  to view this content.
    Please find the workbook attached I get the output in sheet but it is wrong i need it like in Sheet 2. i.e. I need to paste range Q:AE to be pasted from W onwards since W is the next cell after the usedRange. Please help
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: find the last used column and paste the rows alongside the last column.

    Maybe:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: find the last used column and paste the rows alongside the last column.

    thanks for the response. you are close to the solution. Right now in row 3 it loads the values from Column P till the end but it has to be pasted from Column W since that was last column used in the input sheet. I need a empty cells between Column Q to Column V. Do you understand what I mean?

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: find the last used column and paste the rows alongside the last column.

    Try the attached.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: find the last used column and paste the rows alongside the last column.

    hi ab33, Thank you for the response. I just saw the sheet2 the row3 has the Proposal 2 values from row 4 to row 6 pasted in Column Q to Column V. But I need the values to be pasted from Column W onwards for row three. That is, I am trying to find the last used column in Sheet 1 and then paste the values from that last column like you did. Its just that now its not pasted in the right column. I appreciate your help.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: find the last used column and paste the rows alongside the last column.

    Try the attached.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: find the last used column and paste the rows alongside the last column.

    thank you ab33. your code works exactly what i wanted. Thank you all for the help

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: find the last used column and paste the rows alongside the last column.

    mvneema,
    You are welcome!
    Please do not forget to mark the thread as solved.

+ 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. find last blank row from column 'c' paste data from that row in column a
    By 13lack13lade in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2013, 07:18 PM
  2. Vba - find next empty column, insert column, copy paste values & copy paste formulas
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 12:43 PM
  3. Loop to find cell, paste to new column. Turn 1 column into many.
    By d0tc0m in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-14-2011, 09:51 AM
  4. Macro to Find end of Column and paste Contents in Column 1
    By donnydorko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-11-2009, 10:23 PM
  5. autofill a column alongside a range - how ?
    By tonto57 in forum Excel General
    Replies: 4
    Last Post: 03-21-2006, 08:15 AM

Tags for this Thread

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