Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-26-2020, 10:16 PM
kingston123 kingston123 is offline Sorting problem in serial column Windows 7 64bit Sorting problem in serial column Office 2010 32bit
Advanced Beginner
Sorting problem in serial column
 
Join Date: Sep 2018
Posts: 85
kingston123 is on a distinguished road
Default Sorting problem in serial column

After deleting entire row, no sorting took place in serial numbers. Serial numbers remain same.



I deleted a row between these two rows:

Reply With Quote
  #2  
Old 02-27-2020, 05:55 AM
gmayor's Avatar
gmayor gmayor is offline Sorting problem in serial column Windows 10 Sorting problem in serial column Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Why would they change? There is nothing to suggest that they are anything but text. If you want the numbers to change you need to replace them with automatic numbering or re-apply the numbers. The following macro will replace the numbers with automatic numbering
Code:
Sub RenumberTable()
Dim oTable As Table
Dim oRng As Range
Dim i As Integer
    Set oTable = Selection.Tables(1)
    For i = 1 To oTable.Rows.Count    'start at 2 if there is a header row
        Set oRng = oTable.Range.Rows(i).Cells(1).Range
        oRng.End = oRng.End - 1
        oRng.Fields.Add Range:=oRng, _
        Type:=wdFieldAutoNum, _
        Text:="\*Arabic", _
        PreserveFormatting:=False
    Next i
    ActiveWindow.View.ShowFieldCodes = False
    Set oTable = Nothing
    Set oRng = Nothing
End Sub
and the next macro will simply renumber the column
Code:
Sub RenumberTable2()
Dim oTable As Table
Dim oRng As Range
Dim i As Integer
    Set oTable = Selection.Tables(1)
    For i = 1 To oTable.Rows.Count    'start at 2 if there is a header row
        Set oRng = oTable.Range.Rows(i).Cells(1).Range
        oRng.End = oRng.End - 1
        oRng.Text = i & Chr(46)
    Next i
    ActiveWindow.View.ShowFieldCodes = False
    Set oTable = Nothing
    Set oRng = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 02-27-2020, 03:05 PM
macropod's Avatar
macropod macropod is offline Sorting problem in serial column Windows 7 64bit Sorting problem in serial column Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by kingston123 View Post
After deleting entire row, no sorting took place in serial numbers. Serial numbers remain same.
Well, if you'd used Word's automatic numbering, that wouldn't be an issue, as those update dynamically. And, if you used SEQ fields for the numbering, a simple print preview would update them. But, if you typed them manually, then you'll have to re-type them - or adopt one of the other methods...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting problem in serial column Problem with ZIP code serial printing Kuzcomerlin Mail Merge 3 01-22-2020 02:12 PM
Sorting problem in serial column Sorting Table one column sorts incorrectly MarieHelp Excel 1 01-13-2017 12:59 AM
Sorting a table by column using a button lozza Word VBA 0 10-27-2016 07:37 AM
Sorting problem in serial column Sorting a long column and printing it on 1 sheet skbutler Excel 2 01-13-2015 05:06 PM
sorting problem gsrikanth Excel 4 02-16-2012 12:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft