limiting characters in a cell by formula

C

Campbell

Hi,

I am trying to import some information into another software system from
excel, unfortunatley in one particular field there is a limit to the amount
of characters that can be entered, so when I try to import the file it's
rejected.

Is there a way I can limit the amount of characters in excel, for example
the original cell might say "this can't be right" but I need a formula to
limit the amount of characters to say 10 to bring it down to "this can't".

does anyone know of a way to do this, I have a feeling there is a way via
macros or VBA but I am not to flash at these.

Cheers

Campbell
 
B

britwiz

Campbell said:
Hi,
Is there a way I can limit the amount of characters in excel, for example
the original cell might say "this can't be right" but I need a formula to
limit the amount of characters to say 10 to bring it down to "this can't".
Cheers

Campbell

Hi Campbell

The formula you want is:

=LEFT(A1,10)

The vba you might want is:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
Target = Left(Target, 10)
End Sub

The macro checks the column to limit, in this case column A; amend it
as necessary.

Regards

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top