+ Reply to Thread
Results 1 to 23 of 23

Merge cell with condition using MACRO for 2007

  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Merge cell with condition using MACRO for 2007

    I am strugling in this concept. Kindly help me to sort this out.

    I have a Excel with first row - Frist column with name - John

    secoung column - First, Second and Third row contains values related to that name.

    I need to move all the values into first row - second column . which is respective to Name John.


    Kindly see the attahment for reference.

    If you could solve this. It is much appreciatable.
    Attached Files Attached Files
    Last edited by rpriyadharsini1987; 07-25-2013 at 06:17 AM. Reason: Need a MACRO for this

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Merge cell with condition

    Refer the attached file for details.

    I have included a User Defined Function Called Clookup which is added in the Module of the attached workbook.

    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
    Attached Files Attached Files


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition

    fsdjkfhskldflskdlfksdlfjsl
    Last edited by rpriyadharsini1987; 07-26-2013 at 02:14 AM.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Merge cell with condition

    Not sure what's happening there

    I don't know what is the need of public sub for Function.

    Public Sub is only for Macro Coding and not for worksheet functions like vlookup,count, counta like that I have created Clookup as one of the function. I named it as Clookup because in my term it means that ConcatenatedLookup.

    Even general Sub and Public Sub both are equal. The word Public is just used to denote that the user wantedly created the macro needs to be shown in Public. But general sub is also the same as public sub. Both will show in the Macro List...

  5. #5
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition

    Sorry. I need a MACRO for this.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Merge cell with condition

    Oh! Sorry for that... I will ask someone for help for accomplishing your task.

  7. #7
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition

    Thanks. Could you tell me the steps how to run this command in excel sheet. I try that too.

    Also I need a macro to do the above activity as I mentioned in attahced EXcel sheet. Could anyone else help me in this?

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Merge cell with condition

    Please wait I called for an help and surely someone will jump in and give solution to you.

  9. #9
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    Hi,

    I have workd on a sample file. open the sheet named "result" and run the macro. let me know if its ok.
    Attached Files Attached Files
    Thanks
    Babu.S

  10. #10
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition using MACRO for 2007

    Hi Babu,

    Its simply writing 0's in sheet 2. I need the macro to
    1. check the A column for data(we can also give input to find the data cell)
    2.If data is there till next data entry it have to take the cell range.eg., A1 contain data, A2& A3 are empty
    3.It should copy B2&B3 cell values to B1 cell. B1 cell data should not be disturbed.
    We should have B1,B2,B3 cells data in B1

    OUTPUT should be like below
    John a b c d
    Edison d e f



    Kindly do the needful.
    Last edited by rpriyadharsini1987; 07-25-2013 at 07:22 AM.

  11. #11
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition using MACRO for 2007

    Great work. Sorry I saw sheet 3. But in results sheet its perfect.

    One small upgrade. Is it possible to enter the data's link by line in the same cell..

    For eg., Now it display as abc in a cell
    Is it possible to display as a
    b
    c

    Or any seperator babu? and also there may be data is whole sheet. but right now it is fetching only 3 values.
    Last edited by rpriyadharsini1987; 07-25-2013 at 07:41 AM.

  12. #12
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    Hi,
    this is a reply for your previous post
    pls check now. see the result in sheet "result".
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    yes, its possible.. give me a moment.

  14. #14
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    Hi,

    Attached 2 types of file as per your need. one with comma seperator, and another with line breaks.
    you can use any1 which ever u like. run the macro, see the sheet "result".
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition using MACRO for 2007

    Sample 2 is fine Babu. But it is taking only till Row "A6". I need all the data because I have such datas till A150th row. Those data can be increased

    For more details, I have attahced my "sample data" sheet with this. Sorry for missed details. In that sheet you can see details in Column B(ID) and Column C(Description). If we go with your concept of copy paste then all other columns will get deleted. i dont want that to happen
    Attached Files Attached Files
    Last edited by rpriyadharsini1987; 07-25-2013 at 08:04 AM.

  16. #16
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    i have extnded it till 150th row. i have added sum datas to check. pls see attachment.

    if you want to increase it further pls change the row number (instead for 150) in the below and paste it to ur module.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    give me a moment. will revert back.

  18. #18
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    Hi,

    i ve worked considering ur file. pls run the macro, and check in result sheet.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition using MACRO for 2007

    here is the sample data
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    pls check this.
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition using MACRO for 2007

    Great Job. Fantastic. Really a great work in short period of time. Not words to appreciate.Tons of Thanks.

  22. #22
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Merge cell with condition using MACRO for 2007

    ur welcome. have a great day!!

  23. #23
    Registered User
    Join Date
    07-24-2013
    Location
    Coimbatore
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Merge cell with condition using MACRO for 2007

    Your solution is fine babu. But is taking data only till row 84. But I have some other data till 1000 rows. we have lot of data. could you help me to sort this?

+ 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. Merge All Sheets Data Into Master Sheet Based on a condition
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2012, 05:24 AM
  2. open a comment to cell range upon true condition then removing comment on false condition
    By ferrum_equitis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 12:55 AM
  3. Merge rows by condition from one workbook to another
    By WilliamV in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 02-09-2012, 11:31 AM
  4. merge and reset a merge based on cell content
    By salkovsg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2007, 07:08 PM
  5. Merge ranges based on condition
    By BrianDP1977 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2005, 09:20 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