Break CCard Number into sets of four

stokie21

Board Regular
Joined
Dec 31, 2008
Messages
95
Hi guys, How do i get a cell to break a card number into sets of 4?

at the moment its in one big lump!

1234567891234567

i want the satff to enter the card number as above, but i also want excel to spit it for me so it reads 1234 5678 9123 4567


Thanks
 
Hermanito

I didn't think it would work but like you I tested.

I'm sure I had problems with merged cells and the change event recently.

Though when I think about it, it might actually have been selection change.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
It does work with merged cells, but I still wouldn't recommend using them.

Try formatting the cells as Center Across Selection.

As for the code not working, where did you put it?

It should go in the worksheet module of whatever worksheet the credit card details are being entered in.


I right clicked the sheet number at the bottom of the page and went to view code

it opened an edit thingy and a little white window i then put the code in there, i clicked save and got this


errorag.png
 
Upvote 0
You need to save the file as macro-enabled, ie xlsm.
 
Upvote 0
thats better!! works now!

Thanks for all your help with this one

Just hope it works in office 2007 as i have doen it all in 2010!

Thanks
 
Upvote 0
It should, but if you can you should do this sort of thing in the earliest version of Excel the workbook could be used with.
 
Upvote 0

Forum statistics

Threads
1,225,155
Messages
6,183,208
Members
453,151
Latest member
Lizamaison

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