+ Reply to Thread
Results 1 to 4 of 4

VBA for Merging the selected Rows

  1. #1
    Registered User
    Join Date
    10-07-2021
    Location
    vijayawada
    MS-Off Ver
    2010
    Posts
    4

    Question VBA for Merging the selected Rows

    Dear sir ,
    I
    am Siddhartha, a new learner into VBA programming ,
    I have been learning them watching your Videos,

    I have recently created a user form for New supplier register,
    where i have been trying to capture those data into a excel form ,i was successful to certain extent , but according to the user form , i have few columns containing details in different Rows , where as few columns Represents those few rows with same details , as below




    Based on the attachment i want merge row 7,6,5,4 as one row,
    This has to continue every 4 rows once

    with regrads

    siddhartha

    Screenshot_15.png

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: VBA for Merging the selected Rows

    Hello Siddhartha...
    Welcome to the Forum...Rule No 1 in Excel...Don't merge cells...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    10-07-2021
    Location
    vijayawada
    MS-Off Ver
    2010
    Posts
    4

    Re: VBA for Merging the selected Rows

    Hello there!!!

    I understand , but this excel and user-form i am going to create are having 300 supplier
    So i wanted to automate the so details for that purpose i have created a user-form and used some VBA code that i have learned
    and data here is huge in our company.

    I got struct at one point , Can any pls help ,

    i am attaching my work-book

    Column A Column B Column C Column D Column E
    Supplier Name Address Phone No contact Material
    ----------------------------------------------------------------
    M/s Smarco 40-6-1,Hyderabad 099634*** Siddhu copper
    Manganese
    Sulfur

    Here when i seen them on excel sheet due to more number of rows occupied the column E , in rest of the columns , few rows are empty
    so wanted to claim those as one Row , so that data looks clean .

    can we have any code for that i have tried , them could not work out,
    ----------------------------------------------------------------------------------------------------------------------------------------
    Sub vba_merge()

    With sh.Range("B" & n + 4)
    .Merge
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlCenter

    End With

    End Sub
    -----------------------------------------------------------------------------------------------------------------------------------------

    and also text in one column is not wrapping automatically how can i do that ,

    I am attaching my work sheet for your Reference

    Note : while preview it is showing different , Material Column is having details in more rows as compared with other columns,
    so i want other columns Rows individually as one Row so as to match with column-E, So that i can View them as set of details of a supplier

    with regards,

    Siddhartha.M
    Attached Files Attached Files

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: VBA for Merging the selected Rows

    And now expecting to merge cells in an Excel Table...Not possible...Only possible in a range...
    I would re-look at your data and join the material in same cell with a separator...By merging you are going to open up a whole "can of worms" with future VBA requirements...

+ 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] Automate the Merging of Selected Cells in an Outlook Message Table
    By dangelor in forum Outlook Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2020, 04:50 PM
  2. Merging selected lines in a worksheet to one line - removing dupes - Office 2013
    By cultivator in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-12-2014, 04:25 PM
  3. merging cells and changing color once option from table is selected
    By withy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2013, 09:08 PM
  4. [SOLVED] Merging selected sheets with selected columns into another sheet
    By harry_1805 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 01:51 PM
  5. Replies: 2
    Last Post: 08-28-2011, 02:39 AM
  6. Merging rows of data and insertin rows conditionally
    By classixuk in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-28-2010, 07:02 PM
  7. [SOLVED] shortcut for merging selected cells would be nice.
    By drgb in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2005, 11:31 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