Hey... Im TOTALLY New to VBA, but I have an xls and i need to put all the items in a column in ' '
so i need to make coulmn D go from
a
b
c
d
TO:
'a'
'b'
'c'
'd'
There are over 700 rows in the sheet, otherwise id do it by hand. Any suggestions?
Printable View
Hey... Im TOTALLY New to VBA, but I have an xls and i need to put all the items in a column in ' '
so i need to make coulmn D go from
a
b
c
d
TO:
'a'
'b'
'c'
'd'
There are over 700 rows in the sheet, otherwise id do it by hand. Any suggestions?
Hmmm ...
Here is the Macro, but it shows up a funny behavior ... Excel does not like to display the leading ' character! It shows up in the formula window, but not in the cell. If you want it to show up in the cell, you will have to insert TWO ' characters in the prefix string. Maybe it has something to do with how the cell is formatted.
Anyway, select the entire range you want to modify and run the macro.Good luck and good learningCode:Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/1/2005 by guawd1
'
Dim acell As Range
Dim astr As String
For Each acell In Selection.Cells
astr = CStr(acell.Value)
acell.Value = "''" & astr & "'" 'Play around with the number of ' characters
Next
'
End Sub
if you look in the cell edit window the ' is shown correctly,
one solution is to put a leading space
acell.Value = " '" & astr & "'"
pete