Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default Limiting a Column to "X" Number of Characters

I can't find a way to edit my original question, so I'm restating it here.
Marcelo gave me a great response, but what I want is to limit it to 33
characters even if there are 100 characters in the response. What happens
with the Data--Validation is that if you enter a response over 33, if rejects
the response. I want it to take the first 33 characters and enter that
information and ignore the rest. I hope this makes sense.

Thanks,

Wayne
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Limiting a Column to "X" Number of Characters

Use one column for the full repsonse and a formula to extract the first 33
characters of the response:

=LEFT(A1,33)

Where A1 is the cell containing the value and 33 is the number of characters
to extract. If the response is under 33 you get the full value and if over
only the first 33 characters.
--
Kevin Backmann


"Wayne" wrote:

I can't find a way to edit my original question, so I'm restating it here.
Marcelo gave me a great response, but what I want is to limit it to 33
characters even if there are 100 characters in the response. What happens
with the Data--Validation is that if you enter a response over 33, if rejects
the response. I want it to take the first 33 characters and enter that
information and ignore the rest. I hope this makes sense.

Thanks,

Wayne

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,047
Default Limiting a Column to "X" Number of Characters

I sorry I do not have a correct understand of your question.


--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"Wayne" escreveu:

I can't find a way to edit my original question, so I'm restating it here.
Marcelo gave me a great response, but what I want is to limit it to 33
characters even if there are 100 characters in the response. What happens
with the Data--Validation is that if you enter a response over 33, if rejects
the response. I want it to take the first 33 characters and enter that
information and ignore the rest. I hope this makes sense.

Thanks,

Wayne

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Limiting a Column to "X" Number of Characters

Excel doesn't offer this kind of feature.

There are other options, though.

#1. You could use one cell for the input and another cell to retrieve the first
33 characters:
=left(a1,33)

#2. You could use an event macro that would truncate any entry to 33 characters
or less. If you want to try this, rightclick on the worksheet that should have
this behavior. Select View Code and paste this into the code window that just
opened.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim MaxLen As Long

MaxLen = 33

'one cell at a time!
If Target.Cells.Count 1 Then Exit Sub

'only in column A:
If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

On Error GoTo ErrHandler:

If Len(Target.Value) MaxLen Then
Application.EnableEvents = False
Target.Value = Left(Target.Value, 33)
End If

ErrHandler:
Application.EnableEvents = True
End Sub

Then back to excel to test it out.

Remember that this converts anything to the first 33 characters--it'll convert
formulas that evaluate to longer than 33 characters to values of 33 characters.

#3. You could design a userform to do the data entry.

Debra Dalgleish has some getstarted instructions for userforms at:
http://contextures.com/xlUserForm01.html


Wayne wrote:

I can't find a way to edit my original question, so I'm restating it here.
Marcelo gave me a great response, but what I want is to limit it to 33
characters even if there are 100 characters in the response. What happens
with the Data--Validation is that if you enter a response over 33, if rejects
the response. I want it to take the first 33 characters and enter that
information and ignore the rest. I hope this makes sense.

Thanks,

Wayne


--

Dave Peterson
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
Chg 1 "Last, First Mid" column to 3 "First", "Middle", "Last" colu JBird11002 Excel Discussion (Misc queries) 4 August 15th 08 06:31 PM
Limiting a Column to "X" Number of Characters Wayne Excel Discussion (Misc queries) 2 June 26th 08 12:35 AM
how i convert "100" to "hundred"( number to text) in excel-2007 mohanraj Excel Worksheet Functions 1 May 11th 08 09:07 PM
The number of characters in a "Screen Tip" Wyebird Excel Discussion (Misc queries) 1 January 23rd 08 05:18 PM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM


All times are GMT +1. The time now is 06:07 AM.

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"