Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding quotation marks to each line of cell contents with carriagereturns

Hi All,

I am using Excel as an interface to import some process data into a
modelling tool. One of the limitations of the modelling tool is that
any data in the sheet has to be enclosed in quote or speech marks to
import the data.

I have only just discovered this and have a lot of data that has been
imported into the tool which is now unreadable.

Can anyone provide some VBA that will add speech marks i.e. " sample
text " to each line of text in each cell.

Thanks in advance.

Will
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Adding quotation marks to each line of cell contents with carriage returns

each line of text in each cell.

If you mean you might have multiple lines in a cell separated with LineFeeds
try the following. Select cells in a column and ensure there are empy cells
to the right, run the macro.

Sub QuoteEm()
Dim i as Long
Dim va
Dim rCell As Range

For Each rCell In Selection
va = Split(rCell, vbLf)
For i = LBound(va) To UBound(va)
va(i) = Chr(34) & va(i) & Chr(34)
Next
rCell.Offset(, 1) = Join(va, vbLf)
Next

End Sub

Regards,
Peter T


"Will" wrote in message
...
Hi All,

I am using Excel as an interface to import some process data into a
modelling tool. One of the limitations of the modelling tool is that
any data in the sheet has to be enclosed in quote or speech marks to
import the data.

I have only just discovered this and have a lot of data that has been
imported into the tool which is now unreadable.

Can anyone provide some VBA that will add speech marks i.e. " sample
text " to each line of text in each cell.

Thanks in advance.

Will



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Adding quotation marks to each line of cell contents with carriage returns

Sub cellquotes()
Dim cell As Range
For Each cell In Range("A1:A100").Cells
If cell.Value < "" Then
cell.Value = Chr(34) & cell.Value & Chr(34)
End If
Next
End Sub

"Peter T" <peter_t@discussions wrote in message
...
each line of text in each cell.


If you mean you might have multiple lines in a cell separated with
LineFeeds try the following. Select cells in a column and ensure there are
empy cells to the right, run the macro.

Sub QuoteEm()
Dim i as Long
Dim va
Dim rCell As Range

For Each rCell In Selection
va = Split(rCell, vbLf)
For i = LBound(va) To UBound(va)
va(i) = Chr(34) & va(i) & Chr(34)
Next
rCell.Offset(, 1) = Join(va, vbLf)
Next

End Sub

Regards,
Peter T


"Will" wrote in message
...
Hi All,

I am using Excel as an interface to import some process data into a
modelling tool. One of the limitations of the modelling tool is that
any data in the sheet has to be enclosed in quote or speech marks to
import the data.

I have only just discovered this and have a lot of data that has been
imported into the tool which is now unreadable.

Can anyone provide some VBA that will add speech marks i.e. " sample
text " to each line of text in each cell.

Thanks in advance.

Will



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Adding quotation marks to each line of cell contents withcarriage returns

On 22 July, 11:09, "Patrick Molloy"
wrote:
Sub cellquotes()
Dim cell As Range
For Each cell In Range("A1:A100").Cells
* * If cell.Value < "" Then
* * * * cell.Value = Chr(34) & cell.Value & Chr(34)
* * End If
Next
End Sub

"Peter T" <peter_t@discussions wrote in message

...



each line of text in each cell.


If you mean you might have multiple lines in a cell separated with
LineFeeds try the following. Select cells in a column and ensure there are
empy cells to the right, run the macro.


Sub QuoteEm()
Dim i as Long
Dim va
Dim rCell As Range


* *For Each rCell In Selection
* * * *va = Split(rCell, vbLf)
* * * *For i = LBound(va) To UBound(va)
* * * * * *va(i) = Chr(34) & va(i) & Chr(34)
* * * *Next
* * * *rCell.Offset(, 1) = Join(va, vbLf)
* *Next


End Sub


Regards,
Peter T


"Will" wrote in message
...
Hi All,


I am using Excel as an interface to import some process data into a
modelling tool. *One of the limitations of the modelling tool is that
any data in the sheet has to be enclosed in quote or speech marks to
import the data.


I have only just discovered this and have a lot of data that has been
imported into the tool which is now unreadable.


Can anyone provide some VBA that will add speech marks i.e. " sample
text " to each line of text in each cell.


Thanks in advance.


Will- Hide quoted text -


- Show quoted text -


Great, thanks Peter and Patrick
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop Excel adding quotation marks when copying to notepad? AI32768 Excel Discussion (Misc queries) 6 January 29th 21 05:10 AM
CELL return value without double quotation marks Rui Gomes Excel Worksheet Functions 1 November 14th 07 10:40 PM
Adding Quotation Marks to Data already in Mulitple Cells Ron Setting up and Configuration of Excel 3 February 23rd 07 06:15 PM
add quotation marks to each cell in a column sauceraus Excel Discussion (Misc queries) 3 January 29th 07 07:08 PM
Wrapping cell contents in quotation marks Daminc[_16_] Excel Programming 3 November 9th 05 11:27 AM


All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"