#1
|
|||
|
|||
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!! |
#2
|
|||
|
|||
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. |
#3
|
||||
|
||||
Quote:
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] |
#4
|
|||
|
|||
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 |
#5
|
||||
|
||||
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 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] |
#6
|
|||
|
|||
haha pour away. I freely admit that I have no understanding of coding (unfortunately)
I will try this out, thanks! |
#7
|
|||
|
|||
Works like a charm! Thank you so much for the help. You have no idea how much this will help!
|
Tags |
parentheses |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Allignment of numbers with parentheses | RussBell | Mail Merge | 2 | 10-28-2016 05:51 AM |
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 |
Make text value in a cell appear in parentheses | Scaffold | Excel | 4 | 08-13-2014 06:26 AM |
Parentheses Changing on Document | Subject1157 | Word | 2 | 06-16-2011 08:46 PM |