How do I use a Macro to ...

  • Thread starter Thread starter Noel
  • Start date Start date
N

Noel

Can anyone help me?
I need a macro to put double-quote (") delimiters around all the data
in a spreadsheet (or currently selected cells will do) - that is add "
to the start and " to the end of all data - including the nulls - in a
selected set of cells.

Can a macro change the data contents of a cell?
 
One way:

Sub foo()
Dim c As Range

For Each c In selection
If IsEmpty(c.Value) Then
c.Value = """"""
Else
c.Value = """" & c.Value & """"
End If
Next
End Sub

Select the cells you want and run the macro.

HTH

-Dave
 
Back
Top