VBA: Quickly Merge Cells with Same Values in Excel
Вставка
- Опубліковано 9 лют 2025
- #MergeSameCells #VBAtutorial #ExcelTips
Hello Friends,
In this video you will learn how to merge cells with same values in Excel using VBA. This is a time saving trick. You can copy this code to your personal macro so that it can be available for each workbook.
Please download this excel file from below given link:
www.pk-anexcel...
Download our free Excel utility Tool and improve your productivity:
www.pk-anexcel...
See our Excel Products:
www.pk-anexcel...
Visit to learn more:
Chart and Visualizations: www.pk-anexcel...
VBA Course: www.pk-anexcel...
Download useful Templates: www.pk-anexcel...
Dashboards: www.pk-anexcel...
Watch the best info-graphics and dynamic charts from below link:
• Dynamic Graphs
Learn and free download best excel Dashboard template:
• Excel Dashboards
Learn Step by Step VBA:
• VBA Tutorial
Website:
www.PK-AnExcel...
Facebook:
/ pkanexcelexpert
Telegram:
t.me/joinchat/...
Twitter:
/ priyendra_kumar
Pinterest:
/ pkanexcelexpert
Send me your queries on telegram:
@PKanExcelExpert
************ Suggested Books ********
VBA: amzn.to/2TMMikX
Excel Dashboard: amzn.to/2WZi2Fj
Power Query: amzn.to/2Ibd7xR
Power Pivot and Power BI: amzn.to/2DCg8BB
Exam Ref 70-778 (Power BI): amzn.to/2GnWYTN
************ My Stuff ***************
Mic : amzn.to/2TLnF88
Video Editor: screencast-o-m...
Thank you Sir. The code was explained in very simple and easy to understand way. Please keep it up.
Thanks for your valuable feedback
Amazing, exactly what I was looking for. Thank you!
Thanks for your valuable feedback
Thank you so much! Ended up downloading your AddIn
Thanks 🙏
Thank You sir. You saved me a lot of time. especially by providing the code.
Thanks for your valuable feedback
I was struggling on this issue today, this helped me very much. thanks :)
Thanks for your valuable feedback
Super helpful. Thank you!
You're welcome!
I was searching for this thanks 🎉🎉🎉
Most welcome🙏
Sir,You are the only youtuber who give and teach Vba code properly and also tell us how it works step by step.Other just say link in description box you can get from there.Hats off to u sir🫡🫡
Thanks
Thank God the main part of this program is only a few lines long and also for you starting with the main part. Also thank you for demonstrating the script at the beginning. This is a great thing for spreadsheets to be able to do to make data clearer. It should be a standard function.
I've often wanted this for many things. I am using it now for query results, kind of a quick and dirty grouping report for my own use. It makes the data VERY VERY much each easier to see and find what I'm looking for.
it's very useful, thanks a lot. You got my subscription.
Thanks for your valuable feedback
Wow... Thank you so much... It helps a lot... I want to organize data which is in 1000s and was searching for efficient way to group and order by specific range and here it is... Simply outstanding and easy..😊👍
Thanks for your valuable feedback
LIFE SAVER! THANK YOU!
You're welcome!
Thank you so much for this!! You just saved me from 800 rows of data!! Cheers!
Thank you so much!!! Keep the good job ;)
Thanks for your valuable feedback
Thanks! very helpful!
Glad it helped!
You are the best!
Thanks🙏
Sir i have seen this video sir
Actually exact need this one sir
Its very usefull sir
Thanks
Thank you Sir, It was really helpful for me.
Glad to hear that
You're the best, thanks for the tutorial.
Thanks very much. Cool trick
Thanks for your valuable feedback
this is amazing!!! Thank you so much for your help and offer to download. It works perfectly
Thanks
Thank you so much , it works perfect 👍👍👍
Thanks for your valuable feedback
Your channel is amazing!!!!! Thanks for sharing well explained, quality content.
Thanks for your valuable feedback
Super helpfull!!! thank you
Most welcome🙏
Great tips thank you
Thanks for your valuable feedback
Excellent !!! Great Job.
Thanks for your valuable feedback
Thankyou...helped me a lot
Most welcome
Super explanation👍👍👍👍🎂🎂🎂🌹🌹🌹🌹
Thanks🙏
very nice tutorial
Thanks for your valuable feedback
Awesome one sir as usual 👏👏👏
Thanks for your valuable feedback
Good one!
Thanks🙏
You're the goat!
THANK YOU FOR YOUR HELP
Welcome
Very helpful. Thank you
Thanks for your valuable feedback
Thank you very much for this great video and for this excellent explanation.
Thanks for your valuable feedback
Out standing
Thanks for your valuable feedback
thanks!
Welcome!
Beautiful work as usual. Thanks for the share.
Thanks for your valuable feedback
Great thank you! still so useful
Thanks for your valuable feedback🙏
Thanks a lots.
Most welcome!
Thank you sir🤩 Very useful tool!
Thanks for your valuable feedback
Can we do it with Power Query
Amazing instructions. Thanks, man!
Thanks for your valuable feedback
Simply great. Thank you so much.
Thanks for your valuable feedback
thank you for sharing knowledge is very helpful
under the code "If rng.Value = rng.Offset(1, 0).Value And rng.Value "" Then", excel shows error 1004, that is, rng.value is neither application-defined or object defined; rng.Value = empty. Please help.
Thank you, it works.
You're welcome!
Very helpful. Thank you very much.
Thanks for your valuable feedback
Sir, that's really good. My requirement is different, I want to merge rows (different data) in one cell (looks like rows only) without losing any data.
great video thank you so much for this solution.
Thanks for your valuable feedback
Can we use this for date column
And One more thing i want that i want to sum the value in another column....plz help
Thank you. Excel file need to be .xlsm format to work
Thanks a ton, subscribing your channel for this video.
Thanks for watching and subscribing. Welcome 🙏
Sir I want to fill the data to the right and merge to the right how can I do t can you explain it sir
Thank You very much , code neat and clear, i have query, suppose if we have one row of column with value, next 3 rows blank, any after the blank row one more rows starts with another different value, and this continues for every 3 blank rows a new row with details is present in the sheet, then how to merge with VBA
Thank you, your tutorial is very helpful. How would you change the macro if you want the merge to be across columns? My range would be from Col. J to Col. BI and I would like to combine (consecutive) cells wit the same input data.
Excellent!
sir can we merge with out selection vba?
Thank you for explaining the code, it was really helpful. One small question incase if I need to add totals here what should be done
thank a lot of you for sharing this
Thanks for watching
very good..
Thanks for your valuable feedback
Good work
Thank you
Thanks for your valuable feedback
This has helped me a lot but how to have sum of total for merge cells in next column against each merge cell
Hy, i have a question. If the values in the first column is in disorder(in your excel if January is comes again after February) can we use this program??
Can we sum it in the last column based on First column criterion?
Thanks a lot Sir, that's really helpful
Thanks for your valuable feedback
Nice sir, is it possible in google sheet? plz reply
Thank You bro.
You're welcome!
Good vid; thanks for sharing. It would have been nice to include the reverse (unmerge)
thanks so much!!
Thanks for watching
thank you so much , i love you
Thanks for your valuable feedback
Realy helpful
Thanks alot
My man!
Sir, it's helped lot to me. Thank you. Can I use same formula in Google spread sheets. Phase reply me.
but does it have to run every time I open excel because it seems like it needs to run again once I close it and open it again
Thanks for useful video...
How can we add a blank row in each merged cell. Sometime we have only one cell, so need not merge it but need blank row in between two rows.
Thanks in advance
Useful!! However, I come to a problem with this-it will only merge cell that are in order. How about a modified macro where you can merge cells not in order? For example: January, March, January, February, March data order. Thanks
I think then, we have to first sort the column in ascending or descending order and then apply VB
Thank you PK this is so valuable! Subscribed immediately. What if I wanted to also merge blank cells?
Hello, is there is any formula which I can use instead of VBA for marging the data. Plz inform
Excellent
Excellent... thanks a lot. It is extremely useful and I was searching for something exactly like this. Just a question, will it do sorting the whole rows as well ? Like in your example if another pk was at the last of the column, would it bring it up and then do the merge ?
I have the same question
thanks sir
Most welcome
thaank you sir , that's so helpful
Thanks for your appreciation. Request you to please share this with your friends and colleagues.
Is there a way for me to have borders around the merged lines after it is seperated? For example, there would be a new border line between January, Feb, etc. from this code that would show up after the merge?
Yes, we can create border. need to a piece of code accordingly
So, tried this and a few other scripts too, every single thing just throws errors about ';' expected.
Anyone know what's up with that?
How do a create the macro it says error
Sir, I am beginner to vba.. As a beginner how much we need to learn in vba code part? Wat we must knw
thanks dear... wow...
Thanks for your valuable feedback
Help, It says compile error "Label not define" then the GoTo Mergecells are highlightened
How to do the same thing on MS word?
what version of excel should we have to use developer option and all
Developer Tab is available in Excel 2007 and above versions. You need enable this. Please watch below video-
ua-cam.com/video/q8AZ2TGbY7M/v-deo.html
How to Unmerge once data changed from similar range
I am currently using this macro and transposing it when I'm finished. How would you change the Macro to merge same cells within rows instead of columns. Thanks!
AIRJENTZEN I just played around with this, as this video got me on the perfectly correct path. To merge horizontally (as opposed to the displayed vertically), simply invert all 4 of the (1, 0) to read (0, 1).
Could you please give me code for unmering cells and repeat the values of merged cells
Why it's not working for rows merging?
How to avoid null fill for a cell after merging multiple cells
As we I make a filter it looks at the merged cell as empty, however i don't want that
I don't know what changed since you made this but this loop crashes on me. Either it doesn't stop and is merging empty cells or it merges everything correctly then crashes at the if statement when it runs out of values. Its not very robust.
ME ENCANTO PODRIA AYUDARME QUIERO COPIAR VALORES DE ACUERDO AL CHECK DE REVISION Y QUE SOLO ME COPIE ESOS VALORES QUE ESTAN CON EL CHECK A OTRA HOJA PLEASE
sir, i want to merge column based on first value
e.g. in columnA (A2) i have numric value something 50 and after 40 blank rows i have another value like 60, and so on:
please suggest any code