Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Venkatesh V
 
Posts: n/a
Default Insert a special character before and after a word

Hi,
For ex: In a cell, lets say the value is 'Microsoft'. i want to create a
button or a macro such that, if i click that it should insert ')' before &
after that word.

How to do it?

Rgds,
Venkatesh
  #2   Report Post  
Peter Rooney
 
Posts: n/a
Default

Hi, Venkatesh

Try selecting the cell to be modified and running this:

Sub AddBrackets()
Selection.Value = "(" & Selection.Formula & ")"
End Sub

If you want to modify a range of cells, select them then run this:

Sub AddBracketsToRange()
Dim CellToModify As Object
For Each CellToModify In Selection
CellToModify.Formula = "(" & CellToModify.Formula & ")"
Next CellToModify
End Sub

Hope this helps

Pete



"Venkatesh V" wrote:

Hi,
For ex: In a cell, lets say the value is 'Microsoft'. i want to create a
button or a macro such that, if i click that it should insert ')' before &
after that word.

How to do it?

Rgds,
Venkatesh

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"