Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Word Table Sort like Headers
I have a table in MS Word and the first column has a format similar to Headers,
For example: 5.4 5.3.2 6.1 6.18 6.2 6.20 6.2.1 6.3 etc. I am trying to sort them like a header, where 6.2, 6.2.1 comes before 6.18 etc. Any suggestions on how to get it working? |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
Word Table Sort like Headers
JLP1782 wrote: I have a table in MS Word and the first column has a format similar to Headers, For example: 5.4 5.3.2 6.1 6.18 6.2 6.20 6.2.1 6.3 etc. I am trying to sort them like a header, where 6.2, 6.2.1 comes before 6.18 etc. Any suggestions on how to get it working? have an idea on how to get the sorting to work correctly through a macro. But, I am not very good at VB using word. I have been trying for a while to get it working, so, here are the steps: 1) Place the table in a Microsoft Excel worksheet 2) Replace the decimals that are in Column A with A's 3) In the first empty column type the formula =Hex2Dec(A#)...this converts all of the first column stuff to hex 4) In the next empty column, have a thing where it looks at the first number in the Column A, and then do a if it is 1, then "A", 2 would be a "B"... 5) Then the sort would be by step 4 then by step 3 column... 6) Then place it back into word... Any help with the macro, would be great... |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
Word Table Sort like Headers
Answered in microsoft..public.word.vba.general.
-- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP wrote in message oups.com... JLP1782 wrote: I have a table in MS Word and the first column has a format similar to Headers, For example: 5.4 5.3.2 6.1 6.18 6.2 6.20 6.2.1 6.3 etc. I am trying to sort them like a header, where 6.2, 6.2.1 comes before 6.18 etc. Any suggestions on how to get it working? have an idea on how to get the sorting to work correctly through a macro. But, I am not very good at VB using word. I have been trying for a while to get it working, so, here are the steps: 1) Place the table in a Microsoft Excel worksheet 2) Replace the decimals that are in Column A with A's 3) In the first empty column type the formula =Hex2Dec(A#)...this converts all of the first column stuff to hex 4) In the next empty column, have a thing where it looks at the first number in the Column A, and then do a if it is 1, then "A", 2 would be a "B"... 5) Then the sort would be by step 4 then by step 3 column... 6) Then place it back into word... Any help with the macro, would be great... |
#4
Posted to microsoft.public.word.tables
|
|||
|
|||
Word Table Sort like Headers
Now that I learned about these wildcards, it is soo much easier!!!!
Sub Macro1() ' ' Macro1 Macro ' Macro recorded 2/7/2006 by Jessica Patla ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".1" .Replacement.Text = ".01" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".2" .Replacement.Text = ".02" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".3" .Replacement.Text = ".03" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".4" .Replacement.Text = ".04" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".5" .Replacement.Text = ".05" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".6" .Replacement.Text = ".06" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".7" .Replacement.Text = ".07" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".8" .Replacement.Text = ".08" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".9" .Replacement.Text = ".09" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Dim tbl As Word.Table For Each tbl In Word.ActiveDocument.Tables tbl.Select Selection.Sort ExcludeHeader:=True, FieldNumber:="Column 1", SortFieldType _ :=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, FieldNumber2 _ :="", SortFieldType2:=wdSortFieldAlphanumeric, SortOrder2:= _ wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _ wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending, Separator:= _ wdSortSeparateByCommas, SortColumn:=False, CaseSensitive:=True, _ LanguageID:=wdEnglishUS, SubFieldNumber:="Paragraphs", SubFieldNumber2:= _ "Paragraphs", SubFieldNumber3:="Paragraphs" Next tbl Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".01" .Replacement.Text = ".1" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".02" .Replacement.Text = ".2" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".03" .Replacement.Text = ".3" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".04" .Replacement.Text = ".4" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".05" .Replacement.Text = ".5" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".06" .Replacement.Text = ".6" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".07" .Replacement.Text = ".7" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".08" .Replacement.Text = ".8" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ".09" .Replacement.Text = ".9" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll End Sub |
#5
Posted to microsoft.public.word.tables
|
|||
|
|||
Word Table Sort like Headers
It should work with a simple sort, too.
The trick is to set the delimiter in the sort options to the "." ("Options... Separate fields at Other:", type in a dot). You'll have three sort levels. What you'll sort is always "Sort by: Column 1", "Then by: Column 1", "Then by: Column 1". And the type will always be "Number". But you'll be "Using: Field 1", "Using: Field 2", "Using: Field 3". You may have to type in an expression with three "fields", say 5.4.0, in the first row, so Word "sees" the fields correctly. Regards, Klaus "JLP1782" wrote: I have a table in MS Word and the first column has a format similar to Headers, For example: 5.4 5.3.2 6.1 6.18 6.2 6.20 6.2.1 6.3 etc. I am trying to sort them like a header, where 6.2, 6.2.1 comes before 6.18 etc. Any suggestions on how to get it working? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word 97 in Windows XP to maintain formatting | Microsoft Word Help | |||
apply a template to existing documents | Page Layout | |||
is word perfect compatible with office word? | Microsoft Word Help | |||
Envelope Address | New Users | |||
In Word, how can I see all files (*.*) in "save as"? | New Users |