+ Reply to Thread
Results 1 to 10 of 10

Copying data from column heads to the rows based on a condition

  1. #1
    Registered User
    Join Date
    06-08-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Copying data from column heads to the rows based on a condition

    HI I need your help in the following. The macro should do the following task

    Columns E to J marked in yellow are the output cells. This is where the output should be displayed

    Columns from K to BE are the input columns

    If there is 'Yes' in any of these column, then the column heading should be copied and pasted in the output cells

    The same should be repeated for all the rows. Please help me out in this macro
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Copying data from column heads to the rows based on a condition

    In row 2, there are 19 cells (AM2:BE2) that have a yes, with column headings of "AB29" through "AB47". What is it that you would want in E2:J2?
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Copying data from column heads to the rows based on a condition

    copied and pasted in the output cells
    Pasted wherever we feel like pasting them or are you going to be more specific?
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  4. #4
    Registered User
    Join Date
    06-08-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Copying data from column heads to the rows based on a condition

    you can paste it in any order in the columns E to J

    I just gave this sheet as an example as the oringinal sheet has confidential details

    All i want is the column heads for ' Yes' cells

    Eg:

    if in row 2 , the column AB1, AB4, AB6 has 'Yes' then these heads AB1, AB4, AB6 should be copied and pasted in the columns E to F in any order.

  5. #5
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Copying data from column heads to the rows based on a condition

    You still didn't answer my question. How do you fit 19 values into 7 cells?

  6. #6
    Registered User
    Join Date
    06-08-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Copying data from column heads to the rows based on a condition

    I just used 7 cells as an example. You can add more yellow columns and fit those 19 values. I didnt realise there would be 19 'Yes' else i would have added more columns

  7. #7
    Registered User
    Join Date
    06-08-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Copying data from column heads to the rows based on a condition

    @natefarm @skywriter

    Please help me out. I need to make an analysis based on this

  8. #8
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Copying data from column heads to the rows based on a condition

    This should do it.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-08-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Copying data from column heads to the rows based on a condition

    Hi,

    Thanks a lot Natefarm. But the macro is not working if i add more yellow columns to accommodate more 'Yes' heads. Currently i have only 7 yellow columns. But if i add more yellow columns it is not working. What should i do?

  10. #10
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Copying data from column heads to the rows based on a condition

    The value of InCol1 (11) needs to be adjusted to point to the first input column number.

+ 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] to convert one table with column heads in to another table by includng columns heads also
    By catchnanan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-27-2014, 01:21 PM
  2. Copying Rows to to another Sheet based on the column data?
    By BhuvanRam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2012, 12:56 AM
  3. copying and pasting rows based on condition, VBA
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2011, 09:22 PM
  4. Replies: 4
    Last Post: 08-16-2011, 09:32 PM
  5. Copying Rows Based on Condition from Multiple Worksheets to 1
    By codyj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2011, 07:23 PM
  6. Copying Rows to New Sheet Based On Condition
    By Az_Outlaw in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-29-2010, 04:06 PM
  7. Copying rows to new sheet based on condition
    By nraz76 in forum Excel General
    Replies: 5
    Last Post: 10-20-2009, 11:29 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