Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to put quotations around a cells value 1

Status
Not open for further replies.

DrMingle

Technical User
May 24, 2009
116
US
Does anybody know how to put quotes around a value in a cell using a macro?

Sub MacroQuotations()
'
' Macro3 Macro
' Macro recorded 6/20/2009 by drmingle
'

'I need this macro to place quotes around whatever the cell value is in (I8) so that when it is copied and pasted I can make use of the data.
Range("I8").Select
ActiveCell.FormulaR1C1 = Range("I8")
End Sub
 
This is as close as I have gotten....

I only have gotten a single " ... instead of a double " ".

The other thing is I want to name the cell within the code instead of selecting it each time...the cell is ("I8").

Sub AddQuote()
Dim myCell As Range
For Each myCell In Selection
If myCell.Value <> " " Then
myCell.Value = Chr(34) & myCell.Value
End If
Next myCell
End Sub
 
You wanted simply this ?
myCell.Value = Chr(34) & myCell.Value & Chr(34)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top