I', trying to copy the following text to the clipboard but because the text contains quotes it does not recognize the full text.
.Range("Y3").AutoFill .Range("Y3:Y" & .Cells(.Rows.Count, "A").End(xlUp).Row)"
What is the way forward to make the vba to read the text in one line?
Sub CommandButton2_Click()
Dim obj As New DataObject
Dim txt As String
txt = ".Range("Y3").AutoFill .Range("Y3:Y" & .Cells(.Rows.Count, "A").End(xlUp).Row)"
obj.SetText txt
obj.PutInClipboard
MsgBox "VBA text copied to your clipboard!", vbInformation
End Sub
Bookmarks