View Single Post
  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

That is not what was being suggested. Harlan was suggesting using the LEFT
function was that any formula that referenced your input cells included a
LEFT function, so as to only work on the 45 left-most characters.

The problem here is that after running this code any future input can be
greater than 45 characters. That is why we suggested event code. As Frank
suggested, post the code you had for that so we can see if we can identify
why it didn't work.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Colin Hayes" wrote in message
...
In article , Frank Kabel
writes
Hi
you may then post (the relevant part) of your existing event macro


Hi all

OK I managed to get this working , using LEFT(cell,45) as suggested.

It was rather more straightforward than I thought.

This is the final code :


Dim lrow As Long
With ActiveSheet
lrow = Range("A" & Rows.Count).End(xlUp).Row
'Range("A1:A" & lrow).FillDown
End With

'Limit Column A to a Maximum of 45 characters

Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B2").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],45)"
Selection.AutoFill Destination:=Range("B2:B" & lrow),
Type:=xlFillDefault
Range("B2:B" & lrow).Select
Columns("B:B").Select
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns("B:B").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft


Thanks for your help.


Best Wishes

Drno