ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   a macro for inserting (https://www.excelbanter.com/excel-programming/386305-macro-inserting.html)

Spreadsheet Monkey

a macro for inserting
 
I need a solution/macro to insert a minussign (-) into a 10 digit number
between digit 6 and 7 (to get a number looking like this xxxxxx-xxxx)

I need to do it in a single column for all 65 536 lines of code in the
spreadsheet.

who of you is nerd enough to tackle this challenge?

Ron de Bruin

a macro for inserting
 
Hi spreadsheet monkey

You can try this

Dim cell As Range
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
cell.Value = Mid(cell.Value, 1, 6) & "-" & Mid(cell.Value, 7, 4)
Next cell


With a formula you can do this in col B

=MID(A1,1,6)&"-"&MID(A1,7,4)


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"spreadsheet monkey" <spreadsheet wrote in message
...
I need a solution/macro to insert a minussign (-) into a 10 digit number
between digit 6 and 7 (to get a number looking like this xxxxxx-xxxx)

I need to do it in a single column for all 65 536 lines of code in the
spreadsheet.

who of you is nerd enough to tackle this challenge?




All times are GMT +1. The time now is 02:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com