hi
i need a help with a macro that will 4 first letters in the
cell in column "b" and the rest will be deleted
thanks
hi
i need a help with a macro that will 4 first letters in the
cell in column "b" and the rest will be deleted
thanks
I feel like i'm mindreading here..
Do you by any chance want a macro that would take only the first 4 letters of the string in column B?
[vba]
range("B1").value = left(range("B1").value,4)
[/vba]
hi
the cell needs to remane with 4 leters only
the rest should be deleted
thnks
[vba]
Public Sub ProcessData()
Const TEST_COLUMN As String = "B" '<<<< change to suit
Dim Lastrow As Long
Dim i As Long
Application.ScreenUpdating = False
With ActiveSheet
Lastrow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To Lastrow
.Cells(i, TEST_COLUMN).Value2 = Left$(.Cells(i, TEST_COLUMN).Value2, 4)
Next i
End With
Application.ScreenUpdating = True
End Sub
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Hi
thanks for the replay it all works ok
i just have one question why is it taking so long to qalqulate 1000 rows?
thanks
Have you got formulae on that sheet?
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Try turning calculation off whilst it does its thing:
[vba]
Public Sub ProcessData()
Const TEST_COLUMN As String = "B" '<<<< change to suit
Dim Lastrow As Long
Dim i As Long
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
With ActiveSheet
Lastrow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To Lastrow
.Cells(i, TEST_COLUMN).Value2 = Left$(.Cells(i, TEST_COLUMN).Value2, 4)
Next i
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
[/vba]
Great thanks