Avatar of Andreas Hermle
Andreas HermleFlag for Germany

asked on 

split worksheet into new worksheets based on changing value in Column A (by means of an Excel VBA)

Dear Experts:

on the current worksheet I would like to split the current worksheet named 'DataSource' into several worksheets based on the value in Column A,
... ie. whenever the Value in Column A changes, all the rows that belong to this value are to be copied into a new worksheet with the respective value as worksheet name:


Basis (Worksheet named DataSource):
Column A     column B        Column C         Column D
EN-23          House                   New               370 Dollars
EN-23          House                   old                  450 Dollars
EN-23          Apartment           new                380 Dollars
EN-45          House                  old                    220 Dollars
EN-45          House                  new                    93 Dollars
EN-17          HOuse                  old                     84 Dollars
EN-17           HOuse                 new                  30 Dollars


After running the macro:

new worksheet named EN-23 is created with the following contents:
Column A     column B        Column C         Column D
EN-23          House                   New               370 Dollars
EN-23          House                   old                  450 Dollars
EN-23          Apartment           new                380 Dollars


new worksheet named EN-45 is created with the following contents
EN-45          House                  old                    220 Dollars
EN-45          House                  new                    93 Dollars

new worksheet named EN-17 is created with the following contents
EN-17          HOuse                  old                     84 Dollars
EN-17           HOuse                 new                  30 Dollars


Help is very much appreciated. I have attached a sample file for your convenience.

Thank you very much in advance

Regards, Andreas
Split_Worksheet_based_ColumnA.xlsx
CMicrosoft ExcelVBAMicrosoft Office

Avatar of undefined
Last Comment
Andreas Hermle
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Andreas Hermle

ASKER

Rgonzo: great code, works very nice, thank you very much for your superb help. :-)

Rob Henson: Rob, this is very interesting, will test it this evening and then let you know. Thank you very much :-)
Avatar of Andreas Hermle

ASKER

Dear both: great jobs from both of you. I now have two approaches for these kind of tasks. That's really great. Rob: very interesting feature, this pivot approach. Thank you very much for it. Since I was asking for a VBA solution, the majority of the points go to Rgonzo. I hope you understand this.

Have a nice weekend. Regards, Andreas
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo