I need to put text in quotes(")

D

Donna

Thanks for all inputs so far and sorry this is a seperate thread.
I am nearly there.....
I have:-
CellSel = Range("E1")
i = ActiveSheet.Shapes.Count
Line1 = "Sub CommandButton" & i & "_Click"
With ActiveWorkbook.VBProject.VBComponents(ActiveSheet.CodeName).CodeModule
X = .CountOfLines
.InsertLines X + 1, Line1
.InsertLines X + 2, "d=" & CellSel
.InsertLines X + 3, "End Sub"
End With

where cell E1 contains text Hello and i=1 in this case.
This give me the commandbutton code of:-
Sub CommandButton1_Click()
d=Hello
End Sub

But I need the Hello in quotes ("Hello")....d= "Hello". How can I do this.
Cheers Folkes.
 
D

Dave Peterson

I bet Tom meant:

CellSel = chr(34) & Range("E1").Text & chr(34)

(chr() instead of char())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top