View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Auto Insert Parenthesis

Sub parens()
Dim rng1 As Range
Set rng1 = ActiveSheet.Range(Cells(1, 1), _
Cells(Rows.Count, 1).End(xlUp))
For Each cell In rng1
If cell.Value < "" Then
cell.Value = "(" & cell.Value & ")"
End If
Next
End Sub



Gord Dibben MS Excel MVP

On Mon, 11 Jan 2010 07:10:01 -0800, Deb
wrote:

How do I auto-insert parethesis around prepopulated data in a worksheet? I
have a column of information that only if there is information, then I would
like it to be in parenthesis. For example,

A1: data
B1: data
C1: no data
D1: no data
E1: data

I would like to auto-insert parenthesis around the cells that show "data"
but to ignore cells that have "no data". This would involve only 1 column in
the excel file. The cells that contain data would look like this, example:
(Smith) or (Jones) rather than Smith or Jones.