![]() |
quotation marks before and after each input
JE,
I did get it to work and thanks again. Can you tell me how to add the double quotes on the end column. If I have a blank column in the the middle it will put the double quotes, but my last column is currently blank and I need the double quotes there. Also, If I have a dollar sign, such as $45.00, it adds and extra space after it and before the quotes such as $45.00 " Can you help me on these??? Thanks. --- Message posted from http://www.ExcelForum.com/ |
quotation marks before and after each input
This modification will output a fixed field text file with quotes around
each item. Adjust NUMFIELDS as necessary. The space after $45.00 comes from your formatting (e.g., Currency formats as $0.00_(, to allow positive and negative numbers to line up). Using RTrim removes any trailing spaces: Public Sub OutputQuotedCSV() Const QSTR As String = """" Const NUMFIELDS As Long = 10 Dim myRecord As Range Dim myField As Range Dim sOut As String Open "File1.txt" For Output As #1 For Each myRecord In Range("A1:A" & _ Range("A" & Rows.Count).End(xlUp).Row) With myRecord For Each myField In myRecord.Resize(, NUMFIELDS) sOut = sOut & "," & QSTR & _ Replace(RTrim(myField.Text), QSTR, QSTR & QSTR) & QSTR Next myField Print #1, Mid(sOut, 2) sOut = Empty End With Next myRecord Close #1 End Sub In article , iamalex wrote: JE, I did get it to work and thanks again. Can you tell me how to add the double quotes on the end column. If I have a blank column in the the middle it will put the doublequotes, but my last column is currently blank and I need the doublequotes there. Also, If I have a dollar sign, such as $45.00, it adds and extra space after it and before the quotes such as $45.00 " Can you help me on these??? Thanks.---Message posted from http://www.ExcelForum.com/ |
quotation marks before and after each input
|
All times are GMT +1. The time now is 12:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com