Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default truncating pasted text after 250 characters

How would I go about cutting off text in a pasted column and keepin
only the first 250 characters of each cell? Validating the colum
doesn't truncate like I want and nobody is entering data directly int
the spreadsheet - it's all copy and pasting. I've tried using lef
functions, but I'm failing miserably. Can somebody please help she
some light on this problem. I'm guessing it's probably a 2-3 lin
answer and I'm overthinking for a solution. ;)

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default truncating pasted text after 250 characters

Hi
try something like the following macro (will truncate the active
Selection):
Sub trunc_left()
Dim rng As Range
Dim c As Range
Set rng = Selection
For Each c In rng
c.Value = Left(c.Value, 250)
Next
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

How would I go about cutting off text in a pasted column and keeping
only the first 250 characters of each cell? Validating the column
doesn't truncate like I want and nobody is entering data directly

into
the spreadsheet - it's all copy and pasting. I've tried using left
functions, but I'm failing miserably. Can somebody please help shed
some light on this problem. I'm guessing it's probably a 2-3 line
answer and I'm overthinking for a solution. ;)

Thanks!


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default truncating pasted text after 250 characters

I've been trying a similar range function that looks something lik
this:

Sub TrimText()
Dim lLastRow As Long
Dim Sh1 As Worksheet, rng As Range

Set Sh1 = ThisWorkbook.Worksheets("Form")
lLastRow = Sh1.Cells(Rows.Count, "I").End(xlUp).Row
Set rng = Sh1.Range("I2", "I2" & lLastRow)

rng.Value = Left(rng.Value, 250)

Set Sh1 = Nothing
Set rng = Nothing
End Sub


However, nothing gets truncated when pasted in column I2+

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default truncating pasted text after 250 characters

I'm still having problems figuring this problem out. Can anyone pleas
help shed some light on it?

Thanks again

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default truncating pasted text after 250 characters

Hi
what is your problem. A little bit more detail would be helpful :-)


--
Regards
Frank Kabel
Frankfurt, Germany

I'm still having problems figuring this problem out. Can anyone
please help shed some light on it?

Thanks again!


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default truncating pasted text after 250 characters

Sorry about that... It's still early and I'm not fully awake yet...

I used the formula you posted and the subroutine I posted above, bu
the text is still not being truncated when pasted into column I. Fo
example, let's say I have 10 rows of text being pasted into column
starting at I2. I1 is the column name header. All the information i
being pasted correctly, but nothing is being truncated.




Frank Kabel wrote:
[b]Hi
what is your problem. A little bit more detail would be helpful :-


--
Message posted from http://www.ExcelForum.com

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
Why is Excel truncating my text to 255 characters? Mailjust4me Excel Discussion (Misc queries) 1 May 7th 10 07:38 AM
text truncating Overcome by info Excel Discussion (Misc queries) 2 October 1st 07 04:16 PM
Intentionally truncating text characters Doug Excel Discussion (Misc queries) 2 June 22nd 07 12:22 AM
truncating a colum to 55 characters sparkroms Excel Discussion (Misc queries) 3 July 9th 05 12:40 AM
Exported File truncating cell data after 255 characters Sue Rizzo Excel Discussion (Misc queries) 2 March 17th 05 08:47 PM


All times are GMT +1. The time now is 04:59 PM.

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

About Us

"It's about Microsoft Excel"