Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-06-2021, 09:06 PM
Bikram Bikram is offline Changing list numbering Windows 10 Changing list numbering Office 2007
Advanced Beginner
Changing list numbering
 
Join Date: Jul 2021
Location: Nepal
Posts: 94
Bikram is on a distinguished road
Post Changing list numbering

Greeting to all the members, Recently I tried to change lists. For Example, I changed 1 to a, 2 to be, and so on from style name list1 and similarly changed a to i, b to ii, and so on from list2. The macro I wrote works as expected but the macro that I created is lengthy and I just want to know if that can be shortened so that the macro works efficiently and code would be dynamic.

Sub ChangingNumberslists()
Dim i As Integer
Dim rng As Range
Dim ipara As Long
Dim opara As Paragraph
Dim st As Style

Set rng = ActiveDocument.Range
ipara = rng.Paragraphs.Count
For i = ipara To 1 Step -1
Set opara = rng.Paragraphs(i)
Set st = opara.Range.Style
If opara.Range.Information(wdWithInTable) = False Then
opara.Range.Select
If st = "List1" Then
Selection.Range.ListFormat.ConvertNumbersToText
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
With Selection.Range.Font
.Name = "Lato heavy"
.Size = 7.5
End With
Select Case Selection.Text
Case "1."
Selection.TypeText Text:="a."
Case "2."
Selection.TypeText Text:="b."
Case "3."
Selection.TypeText Text:="c."
Case "4."
Selection.TypeText Text:="d."
Case "5."
Selection.TypeText Text:="e."
Case "6."
Selection.TypeText Text:="f."
Case "7."
Selection.TypeText Text:="g."
Case "8."
Selection.TypeText Text:="h."
Case "9."


Selection.TypeText Text:="i."
Case "10."
Selection.TypeText Text:="j."
End Select
End If
If st = "list2" Then
Selection.Range.ListFormat.ConvertNumbersToText
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
With Selection.Range.Font
.Name = "Lato heavy"
.Size = 7.5
End With
Select Case Selection.Text
Case "a."
Selection.TypeText Text:="i."
Case "b."
Selection.TypeText Text:="ii."
Case "c."
Selection.TypeText Text:="iii."
Case "d."
Selection.TypeText Text:="iv."
Case "e."
Selection.TypeText Text:="v."
Case "f."
Selection.TypeText Text:="vi."
Case "g."
Selection.TypeText Text:="vii."
Case "h."
Selection.TypeText Text:="viii."
Case "i."
Selection.TypeText Text:="ix."
Case "j."
Selection.TypeText Text:="x."
End Select

End If
End If


Next
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alignment is changing after numbering hit 100 kingston123 Word 2 08-11-2021 11:04 AM
Changing list numbering List Numbering Set Numbering Value shows missing numbers as hidden text lostenfeld Word 9 01-03-2017 04:27 PM
Changing a list indentation changes its numbering osama Word 7 03-31-2015 02:46 AM
Changing list numbering List Style Numbering picks up out of order number from LATER list spthomas Word 12 12-16-2013 05:23 PM
Changing Figure Numbering Fields 0-1, 0-2, 0-3 chrishart7 Word 0 09-03-2010 12:59 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:48 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