Select only a certain chararcter count

Scaiveau

New Member
Joined
Apr 12, 2011
Messages
3
I need to copy a column, with 30 pLus chatarters in a column of no more than 30 Characrters.
When I go into Data validation, I can select my new colum to read only 30 charaters (so I match my importing format) but when I copy my 30+ characters column in my no more than 30 character, I get notified that my text is too long for each entry. I do not want to re-enter several 1000's of entries. I want my column to read the 1st 30 charatarter and leave behind the left over.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi, welcome to the board.

You can use the =LEFT() function to return the first 30 characters from a string.

For example,
Code:
=LEFT(a1,30)

If you want to also show the remaining characters, you can use
Code:
=MID(a1,31,255)
 
Upvote 0
Hi there,

Welcome to the board.

Maybe try this:

Code:
Sub test()
    lRow = Range("A" & Application.Rows.Count).End(xlUp).Row
    For i = 2 To lRow
        Cells(i, 2).Value = Left(Cells(i, 1).Value, 30)
    Next i
End Sub

Change ranges to suit.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top