Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-16-2016, 08:44 AM
steve8778 steve8778 is offline add parentheses to a letter Windows 10 add parentheses to a letter Office 2016
Novice
add parentheses to a letter
 
Join Date: Nov 2016
Posts: 4
steve8778 is on a distinguished road
Unhappy add parentheses to a letter


Hi, I am very new to this. I have to type a lot of letters & numbers in parentheses and it's cumbersome to have to do it manually.

I'm trying to make a macro (or something similar) in word where I press a button and a letter/ number, then the said letter/number gets put in parentheses. Basically, it would work the same way as pressing shift + a letter to capitalize it.

a3B1 ---> (a)(3)(B)(1)

The only information I could find so far was placing parentheses around highlighted text, but that doesn't really help because the parentheses goes around the whole text instead of each individual letter. If its possible to make something that affect each letter that would work perfectly fine too, I am not picky


Please help!!
Reply With Quote
  #2  
Old 11-16-2016, 11:03 AM
Literalman Literalman is offline add parentheses to a letter Windows 7 64bit add parentheses to a letter Office 2010 64bit
Advanced Beginner
 
Join Date: Feb 2015
Posts: 66
Literalman is on a distinguished road
Default

You should be able to record a macro (under the Developer tab) that goes something like this (with > representing the right arrow key): (>)(>)(>)(>)

Then put the cursor in front of a3B1 or any other group of four characters and run the macro.
Reply With Quote
  #3  
Old 11-16-2016, 03:34 PM
macropod's Avatar
macropod macropod is offline add parentheses to a letter Windows 7 64bit add parentheses to a letter Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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 steve8778 View Post
Hi, I am very new to this. I have to type a lot of letters & numbers in parentheses and it's cumbersome to have to do it manually.....

a3B1 ---> (a)(3)(B)(1)
Your description suggests you're creating multi-level lists, for which you should be using Word's multi-level list numbering tools and properly-defined paragraph Styles to associate with them. With that approach, your paragraphs can be numbered automatically (parentheses included) and, should you need to insert/delete/promote/demote one, all the numbering will auto-adjust.

If you're wedded to your present approach, you could use some wildcard Find/Replace expressions to apply the parentheses. For example:
Find = ([a-z])([0-9])([A-Z])([0-9])
Replace = (\1)(\2)(\3)(\4)
would changed any string like a3B1 to (a)(3)(B)(1) - throughout your document or for just a selected range. No macros required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 11-16-2016, 06:19 PM
steve8778 steve8778 is offline add parentheses to a letter Windows 10 add parentheses to a letter Office 2016
Novice
add parentheses to a letter
 
Join Date: Nov 2016
Posts: 4
steve8778 is on a distinguished road
Talking Solved

Thank you both!! I do the multi list already but this was for sections in laws.

Literalman's suggestion worked perfectly!

I seriously appreciate the help

-steve
Reply With Quote
  #5  
Old 11-16-2016, 07:42 PM
macropod's Avatar
macropod macropod is offline add parentheses to a letter Windows 7 64bit add parentheses to a letter Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

While not wanting to pour scorn on macro suggestion, you'll soon find it's rather inflexible. The following rendition will add parentheses to any selected alpha-numeric string:
Code:
Sub AddParens()
Application.ScreenUpdating = False
Dim i As Long
With Selection.Words.First
  If (InStr(.Text, ")") > 0) Or (InStr(.Text, "(") > 0) Then Exit Sub
  Do While .Characters.Last Like "[ ,.:;?!'" & Chr(7) & "-" & Chr(13) & "]"
    .End = .End - 1
  Loop
  For i = Len(.Text) To 1 Step -1
    With .Characters(i)
      .InsertAfter ")"
      .InsertBefore "("
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
Just don't try it with multi-character roman numerals...

If you assign the macro to a keyboard shortcut, it'll be ready for action without the need to go through the Developer tab, etc.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 11-17-2016, 07:33 AM
steve8778 steve8778 is offline add parentheses to a letter Windows 10 add parentheses to a letter Office 2016
Novice
add parentheses to a letter
 
Join Date: Nov 2016
Posts: 4
steve8778 is on a distinguished road
Default

haha pour away. I freely admit that I have no understanding of coding (unfortunately)

I will try this out, thanks!
Reply With Quote
  #7  
Old 11-17-2016, 07:50 AM
steve8778 steve8778 is offline add parentheses to a letter Windows 10 add parentheses to a letter Office 2016
Novice
add parentheses to a letter
 
Join Date: Nov 2016
Posts: 4
steve8778 is on a distinguished road
Default

Works like a charm! Thank you so much for the help. You have no idea how much this will help!
Reply With Quote
Reply

Tags
parentheses



Similar Threads
Thread Thread Starter Forum Replies Last Post
add parentheses to a letter Allignment of numbers with parentheses RussBell Mail Merge 2 10-28-2016 05:51 AM
add parentheses to a letter Use L and R arrow to move cursor letter to letter, not top of the line mellowkitten Word 2 05-12-2016 07:23 PM
How to replace a letter to random letter with different color? cikanoz87 Word 7 06-18-2015 09:43 PM
add parentheses to a letter Make text value in a cell appear in parentheses Scaffold Excel 4 08-13-2014 06:26 AM
add parentheses to a letter Parentheses Changing on Document Subject1157 Word 2 06-16-2011 08:46 PM

Other Forums: Access Forums

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


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