Thursday, April 17, 2014
Sort Columns of the Table using Word VBA
Sort Word Table columns using Word VBA
The following function uses Selection.Sort, you can try alternative methods if selection is not possible / permissible
Function SortTable()
ActiveDocument.Tables(1).Select()
Selection.Sort(ExcludeHeader:=True, FieldNumber:="Column 1", SortFieldType _
:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, FieldNumber2 _
:="", SortFieldType2:=wdSortFieldAlphanumeric, SortOrder2:= _
wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _
wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending, Separator:= _
wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=False, LanguageID _
:=wdEnglishUS)
Selection.MoveRight(Unit:=wdCharacter, Count:=1)
End Function
The above uses as three column table. Please customize it for your use
See also:
How to use .Net Array.Sort Function in VBA
Case in-sensitive comparison
Monday, April 14, 2014
Maximum Limit of Rows Columns etc in Excel
If you have worked on a large set of data from a non-Excel data source, for example, MS ACCESS, there are chances that you would have stored that in multiple sheets.
This riducules the data management. Now in Excel 2007 and above you have a big Excel workbook with 16384 columns and 10,48,576 rows
Following table gives you how big Excel has grown :)
Excel 2003 | Excel 2007 and above | |
Maximum No of Rows | 65,536 | 10,48,576 |
Maximum No of Columns | 256 | 16,384 |