Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 05-27-2021, 09:39 AM
Shelley Lou Shelley Lou is offline VBA converting manual numbering to auto numbering Windows 10 VBA converting manual numbering to auto numbering Office 2016
Expert
VBA converting manual numbering to auto numbering
 
Join Date: Dec 2020
Posts: 259
Shelley Lou is on a distinguished road
Default VBA convert manual numbering to auto numbering in table

Hi, if anyone can help, I'm looking to add a restart number after each loop. Currently only Definition Level 2-4 restarts but Definition Level 1 just carries on the alphabet. How can I get it restart back to (a) for each definition that has this type of numbering. Thanks


Code:
Sub DPU_ApplyHeadingStylesTable()
Application.ScreenUpdating = False
Dim r As Long, i As Long
With ActiveDocument.Tables(1)
  For r = 1 To .Rows.Count
    With .Cell(r, 2).Range
      If .Characters.First <> "(" Then
        .Style = "DefText"
      Else
        i = Asc(Split(Split(.Text, "(")(1), ")")(0))
        Select Case i
          Case 97 To 104, 106 To 117, 119, 121 To 122: .Style = "Definition Level 1" 'LowercaseLetter
          Case 105, 118, 120: .Style = "Definition Level 2" 'LowercaseRoman
          Case 65 To 90: .Style = "Definition Level 3" 'UppercaseLetter
          Case 48 To 57: .Style = "Definition Level 4" 'Arabic
          
        End Select
        .Collapse wdCollapseStart
        .MoveEndUntil " "
        .End = .End + 1
        .Delete
      End If
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub

Last edited by Shelley Lou; 05-27-2021 at 12:54 PM. Reason: Further info added
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA converting manual numbering to auto numbering Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles stanley Word 4 12-15-2020 10:59 AM
page numbering for manual Bursal Word 1 07-29-2018 02:08 PM
VBA converting manual numbering to auto numbering List Numbering Set Numbering Value shows missing numbers as hidden text lostenfeld Word 9 01-03-2017 04:27 PM
Auto numbering macro desireemm1 Word 1 12-10-2015 07:50 PM
VBA converting manual numbering to auto numbering auto page numbering socomfort Word 2 05-28-2012 04:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:50 AM.


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