Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Sorting numerals with decimals in Word
Hi Kevin,
can all be done. No need of a quirk Excel formula. Assuming, that you are at an intermediate VBA level, here comes what you basically need for sorting, a function to convert, e.g. "10.3.2" to "010.003.002". and a function for back conversion. Public Function FillWith0(sTmp$) As String Dim sArr() As String sArr = Split(sTmp, ".") For l = 0 To UBound(sArr) sArr(l) = Format(sArr(l), "000") Next FillWith0 = Join(sArr, ".") End Function ' --- Public Function Remove0(sTmp$) As String Dim sArr() As String sArr = Split(sTmp, ".") For l = 0 To UBound(sArr) sArr(l) = Format(sArr(l), "0") Next Remove0 = Join(sArr, ".") End Function ' --- Sub convert() MsgBox FillWith0("10.3.2") MsgBox Remove0(FillWith0("10.3.2")) End Sub If you have no idea about programming, then it'll be really tough. -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
apply a template to existing documents | Page Layout | |||
Does Word have Keyboard Merges like Word Perfect does? | Mailmerge | |||
Word2000 letterhead merge | Mailmerge | |||
Underscore (_) will not always display in RTF files (Word 2002). | Microsoft Word Help | |||
Macros - Keyboard Commands | Microsoft Word Help |