Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How can i format text by macro for K1234567 to K-123-45-67
Thanks, Kevin |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Why a macro...Here is a formula to do it...
=LEFT(A1, 1) &"-" & MID(A1, 2, 3) &"-" & MID(A1, 5, 2) &"-" & MID(A1, 7, 2) With your text in cell A1 -- HTH... Jim Thomlinson "Tazflerts" wrote: How can i format text by macro for K1234567 to K-123-45-67 Thanks, Kevin |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hey Gents,
Thanks for the response. To answer the question: The data returned is from a msquery from other tables in the workbook. This occupies from Column A to U. To use the formula would mean inserting or using a column for the formula but when the data is refreshed it would mean recalibrating the formulas again. Instead i have implemented the formula provided in a macro and then create a button with the macro assigned to it. This way the maro runs on the specific column and return the changes to the same column. This is the macro:::::: Public Sub NISFormat() Dim rCell As Range For Each rCell In Selection.Cells With rCell .Value = Left(rCell.Value, 1) & "-" & Mid(rCell.Value, 2, 2) & "-" & Right(rCell.Value, 4) End With Next rCell End Sub ::::::::::::::::::::::::::::::::: Thanks again. "Jim Thomlinson" wrote: Why a macro...Here is a formula to do it... =LEFT(A1, 1) &"-" & MID(A1, 2, 3) &"-" & MID(A1, 5, 2) &"-" & MID(A1, 7, 2) With your text in cell A1 -- HTH... Jim Thomlinson "Tazflerts" wrote: How can i format text by macro for K1234567 to K-123-45-67 Thanks, Kevin |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
you can use =LEFT(B12,1)&"-"&MID(B12,2,3)&"-"&MID(B12,5,2)&"-"&MID(B12,7,2) "Tazflerts" wrote: How can i format text by macro for K1234567 to K-123-45-67 Thanks, Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need help with converting CUSTOM format/TEXT format to DATE format | Excel Worksheet Functions | |||
Change Date Format to Specific Text Format When Copying | Excel Discussion (Misc queries) | |||
Convert numbers from text format to number format | Excel Discussion (Misc queries) | |||
how to format excel format to text format with separator "|" in s. | New Users to Excel | |||
How do i change numbers in text format to number format? | New Users to Excel |