+ Reply to Thread
Results 1 to 15 of 15

Copy paste entire row in another sheet having xyz name

  1. #1
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Copy paste entire row in another sheet having xyz name

    Hi,

    I get daily fresh excel sheet containing data in sheet called "WorkArea", from my client. The data are in columns A to P . But sometimes this data are in 20 rows and sometimes are in 50 rows, sometimes more than that, but the column are fixed. In column "I" I have my clients name. Total clients are four, john, joe, masa and pie. In column "M" have other data which I need to copy and paste in sheet 2. Now I want vba which search name "masa" from column "I". Here the name "masa" sometimes are in 20 cells or sometimes are in 50 cells one below other. After searching name "masa" in column "I", I want to copy data which are in column "M" and paste it in sheet 2 in cell say A1. While pasting, the name "masa" should be pasted in A1 and the copied data from column "M" should be pasted in B1 one below other.

    Again same process, search another name say "pie" from column "I" copy data from column "M" and paste in sheet 2. The "pie" should be pasted in C1 and its data which is taken from column "M" should be pasted D1.

    Ignore all other names. I want only two name from column "I".

    Thanks and best regards.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Copy paste entire row in another sheet having xyz name

    Hi watermasa
    Try this code
    Please Login or Register  to view this content.
    Regards
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    Thanks Yasser
    I used above vba sent by you. But after running, its not copying at all in sheet 2. Sheet 2 remains blank, no copy paste at all.

    Regards

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

    Re: Copy paste entire row in another sheet having xyz name

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    Hi John
    Thank you for your prompt reply.

    Just one changes made in your code is that instead of "Sheet2", I did "Sheet1", Its copying data but not I and M column, copying columns A,B,C and D. And copying upto 80 rows only.

    Please make changes.

    Thanks

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

    Re: Copy paste entire row in another sheet having xyz name

    Can you provide a sample with some dummy data in which it doesn't work as you would like? On my test of some data I made up it seemed to work.

  7. #7
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    I am interested to show my original excel sheet, but could not find attachment option here. Search most but could not find. How do I attach file?

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

    Re: Copy paste entire row in another sheet having xyz name

    Scroll down to Go Advanced in the Quick Reply Window click it then scroll down to the Manage Attachments button, browse to the required file, and then push the Upload button Click Done in the lower left-hand corner..

  9. #9
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    This is original file from my broker update daily in live market. This excel workbook get updated in streaming sheet. We can make changes in WorkArea sheet. Column I, J and M data need in next sheet. In next sheet in column "A" I want CE data from column "M" from WorkArea. In column "B" I want CE data from column "J" from WorkArea. In column "C" I want PE data from column "M" from WorkArea. In column "D" I want PE data from column "J" from WorkArea.

    I also need further requirement.

    Thank you very much John and best regards.
    Attached Images Attached Images
    Last edited by watermasa; 05-21-2015 at 12:52 PM.

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

    Re: Copy paste entire row in another sheet having xyz name

    Try:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    Thanks John,
    The data get copied and pasted, runtime error 9, shown as in attach picture. On workarea sheet all CE rows get deleted or sayfilter option remain ON. No data should be delete from workarea sheet.

    See attachments.
    Attached Images Attached Images
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    John,
    Made small correction. In second last line, instead of "Sheet2", I made "Sheet1" and after this, there is no runtime error.

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

    Re: Copy paste entire row in another sheet having xyz name

    Is it working as you needed?

  14. #14
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    Yes John, Thank you very much.
    Its working fine for me. Just one small quire remains. The data get copy and pasted as per requirement. When I again run code for next day, the data goes below previous day's data. Means it has to overlap or it has to start from A2 cell.

  15. #15
    Registered User
    Join Date
    12-21-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Copy paste entire row in another sheet having xyz name

    Hi John, Thank You.
    One more help need from you.
    Your above code is working fine. I made some changes and the code became as follows:-

    Sub watermasa()
    Dim x As String, y As String
    x = InputBox("Please Enter the first name")
    y = InputBox("Please Enter the second name")

    With Sheets("ADANIENT")
    .Range("C1:C" & .Range("C" & Rows.Count).End(3).Row).AutoFilter 1, x
    .Range("D2:D" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIENT").Range("F" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .Range("B2:B" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIENT").Range("G" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .AutoFilterMode = False
    .Range("C1:C" & .Range("C" & Rows.Count).End(3).Row).AutoFilter 1, y
    .Range("D2:D" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIENT").Range("H" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .Range("B2:B" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIENT").Range("I" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .AutoFilterMode = False
    End With

    With Sheets("ADANIPORTS")
    .Range("C1:C" & .Range("C" & Rows.Count).End(3).Row).AutoFilter 1, x
    .Range("D2:D" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIPORTS").Range("F" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .Range("B2:B" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIPORTS").Range("G" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .AutoFilterMode = False
    .Range("C1:C" & .Range("C" & Rows.Count).End(3).Row).AutoFilter 1, y
    .Range("D2:D" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIPORTS").Range("H" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .Range("B2:B" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("ADANIPORTS").Range("I" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .AutoFilterMode = False
    End With

    With Sheets("APOLLOTYRE")
    .Range("C1:C" & .Range("C" & Rows.Count).End(3).Row).AutoFilter 1, x
    .Range("D2:D" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("APOLLOTYRE").Range("F" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .Range("B2:B" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("APOLLOTYRE").Range("G" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .AutoFilterMode = False
    .Range("C1:C" & .Range("C" & Rows.Count).End(3).Row).AutoFilter 1, y
    .Range("D2:D" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("APOLLOTYRE").Range("H" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .Range("B2:B" & .Range("C" & Rows.Count).End(3).Row).SpecialCells(12).Copy
    Sheets("APOLLOTYRE").Range("I" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
    .AutoFilterMode = False

    End With
    End Sub


    This new above code is for example, showing only three sheets. I have almost 25 more sheets which has data and need to transfer their respective columns in the same sheets.

    How I make this code short.
    Last edited by watermasa; 05-24-2015 at 03:24 AM.

+ 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 code to copy and paste an entire row from one sheet to another
    By emach in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-24-2013, 12:12 PM
  2. to copy paste the entire row to the new sheet
    By karanpreet in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-15-2013, 10:51 AM
  3. Help with Copy entire row and paste to new sheet
    By 20lgt06 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 09:24 AM
  4. Copy paste entire row different sheet column C
    By nahge123 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-15-2012, 02:16 PM
  5. Copy Entire Row & Paste in First Empty Row On The Same Sheet
    By Emonk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2011, 11:41 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