Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Find next cell with more than 1024 characters

Good morning all:

I have a table with a few cells with about 2000 characters each . Of
course, Excel will not show the text after 1024. I would like to do a
macro that would find the next cell with more than 1024 characters, in
order to format the cell with the macro found on this page:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=421

I could do it manually but it is a merged document and I remerge this
document at least once a week.

Any help?

Thank you!

Souriane

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find next cell with more than 1024 characters

change just the main routine

from
Sub DisplayLongText()
'Adds line feed characters as required on cells in selection that are
longer than 1024 characters
Dim cel As Range
Dim col As Long
For Each cel In Selection
AddLineFeeds cel, col
Next
col = 0 'Force line length dialog to display the next time sub runs
End Sub

to
Sub DisplayLongText()
'Adds line feed characters as required on cells in selection that are
longer than 1024 characters
Dim cel As Range
Dim col As Long
For Each cel In Selection
if len(cel) 1024 then
AddLineFeeds cel, col
end if
Next
col = 0 'Force line length dialog to display the next time sub runs
End Sub


"Souriane" wrote:

Good morning all:

I have a table with a few cells with about 2000 characters each . Of
course, Excel will not show the text after 1024. I would like to do a
macro that would find the next cell with more than 1024 characters, in
order to format the cell with the macro found on this page:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=421

I could do it manually but it is a merged document and I remerge this
document at least once a week.

Any help?

Thank you!

Souriane


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Find next cell with more than 1024 characters

Thanks! Works great! Except for one thing :

If my sheet has 2 rows in a row that has a cell with more than 1024,
then the first letter of the text in the second row will be alone on
the first line like this:

ROW 1:
Servez à ce monsieur une bière et des kiwis. Servez à ce monsieur une
bière et des kiwis. Servez à ce monsieur une bière et des kiwis.
Servez à ce monsieur une bière et des kiwis. Servez à ce monsieur une

ROW 2 :
S
ervez à ce monsieur une bière et des kiwis. Servez à ce monsieur une
bière et des kiwis. Servez à ce monsieur une bière et des kiwis.
Servez à ce monsieur une bière et des kiwis. Servez à ce monsieur une

Any idea?...

On 28 avr, 12:29, joel wrote:
change just the main routine

from
Sub DisplayLongText()
* * *'Adds line feedcharactersas required on cells in selection that are
longerthan1024characters
* * Dim cel As Range
* * Dim col As Long
* * For Each cel In Selection
* * * * AddLineFeeds cel, col
* *Next
* * col = 0 'Force line length dialog to display thenexttime sub runs
End Sub

to
Sub DisplayLongText()
* * *'Adds line feedcharactersas required on cells in selection that are
longerthan1024characters
* * Dim cel As Range
* * Dim col As Long
* * For Each cel In Selection
* * * if len(cel) 1024then
* * * * AddLineFeeds cel, col
* * * end if
* *Next
* * col = 0 'Force line length dialog to display thenexttime sub runs
End Sub



"Souriane" wrote:
Good morning all:


I have a table with a few cells with about 2000characterseach . *Of
course, Excel will not show the text after1024. *I would like to do a
macro that wouldfindthenextcellwithmorethan1024characters, in
order to format thecellwith the macro found on this page:


http://www.vbaexpress.com/kb/getarticle.php?kb_id=421


I could do it manually but it is a merged document and I remerge this
document at least once a week.


Any help?


Thank you!


Souriane- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find next cell with more than 1024 characters

Not sure what length yo are using in the code. The line you posted only had
204 characters. Try changing the 1024 to 1023 or 1022. The comments in the
website code sometimes references 1022 and other times 1024. I believe the
code has to put two character (return and linefeed) in each line which
accounts for two characters. Therefore tthe code will only work when the
line is 1022 and not 1024.

"Souriane" wrote:

Thanks! Works great! Except for one thing :

If my sheet has 2 rows in a row that has a cell with more than 1024,
then the first letter of the text in the second row will be alone on
the first line like this:

ROW 1:
Servez Ã* ce monsieur une bière et des kiwis. Servez Ã* ce monsieur une
bière et des kiwis. Servez Ã* ce monsieur une bière et des kiwis.
Servez Ã* ce monsieur une bière et des kiwis. Servez Ã* ce monsieur une

ROW 2 :
S
ervez Ã* ce monsieur une bière et des kiwis. Servez Ã* ce monsieur une
bière et des kiwis. Servez Ã* ce monsieur une bière et des kiwis.
Servez Ã* ce monsieur une bière et des kiwis. Servez Ã* ce monsieur une

Any idea?...

On 28 avr, 12:29, joel wrote:
change just the main routine

from
Sub DisplayLongText()
'Adds line feedcharactersas required on cells in selection that are
longerthan1024characters
Dim cel As Range
Dim col As Long
For Each cel In Selection
AddLineFeeds cel, col
Next
col = 0 'Force line length dialog to display thenexttime sub runs
End Sub

to
Sub DisplayLongText()
'Adds line feedcharactersas required on cells in selection that are
longerthan1024characters
Dim cel As Range
Dim col As Long
For Each cel In Selection
if len(cel) 1024then
AddLineFeeds cel, col
end if
Next
col = 0 'Force line length dialog to display thenexttime sub runs
End Sub



"Souriane" wrote:
Good morning all:


I have a table with a few cells with about 2000characterseach . Of
course, Excel will not show the text after1024. I would like to do a
macro that wouldfindthenextcellwithmorethan1024characters, in
order to format thecellwith the macro found on this page:


http://www.vbaexpress.com/kb/getarticle.php?kb_id=421


I could do it manually but it is a merged document and I remerge this
document at least once a week.


Any help?


Thank you!


Souriane- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -



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
Word Wrap with 1024 characters Excel 2003 gsquestion Excel Discussion (Misc queries) 0 February 9th 10 08:55 PM
Any ideas how to copy more than 1024 characters? toolman74 New Users to Excel 6 April 14th 09 05:02 PM
Error message is Character Limit is over 1024 characters Vick Excel Discussion (Misc queries) 2 January 30th 09 06:19 PM
how do i get a cell in a sheet to show the last 1024 characters? XenneX Excel Worksheet Functions 1 September 6th 06 02:02 PM
Display text 1024 characters in a cell Martin Excel Worksheet Functions 6 November 12th 05 11:25 PM


All times are GMT +1. The time now is 08:38 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"