Create macro to separate first name and last name in email and plug it into columns

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
445
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Dear all,

I am currently working on a spreadsheet that looks like this, albeit the real one is much larger:

1642513991403.png


I was wondering if there would be some way in which I could create a macro or some VBA code attached to a macro where, once i press it, it takes the e-mails from C2-C12 and takes the first name and puts it in column A and the last name in column B. Almost all of the emails that I work with have emails that basically follow a rule of "Firstname.Lastname@email.com". If they do not have this first name separated from the last name by a dot ".", I would like for the macro to return the value "X" and "X" for both first name and last name in column A and B.

Is this possible? And if so, how might I carry out such a task?

Thank you so much for your time and assistance everybody! It is greatly appreciated.

Please let me know if you have questions or need further information and I will respond ASAP.

Kindest regards,
Jyggalag.
 
If you are trying to run the macro from the button, then you have assigned the wrong macro.
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If you are trying to run the macro from the button, then you have assigned the wrong macro.
It works now! Perfec! Thank you so much Fluff! You continue to be my personal Excel hero :D

And apologies for the oversight on my behalf :)
 
Upvote 0
If you are trying to run the macro from the button, then you have assigned the wrong macro.
Out of curiosity, is the solution also possible through formulas, or would that be too complex compared to a nice VBA solution such as the one that you created?
 
Upvote 0
The macro is just using a formula. compare the formula in post#3 to the macro in post#4
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top