Option Explicit
Sub Copy4Letters()
'copies sheet1!A1...
'to sheet2!A1..
' but only first 4 letters
Dim lastrow As Long
lastrow = Worksheets("Sheet1").Range("A1").End(xlDown).Row
With Worksheets("Sheet2")
With .Range(.Range("A1"), .Cells(lastrow, 1))
.Formula = "=LEFT(Sheet1!A1,4)"
.Calculate
.Value = .Value
End With
End With
End Sub
"reena" wrote:
I want to write a macro for copying first number of letters of a value
of the cell.
for eg.
My column contains values as
abcdefghijklmnop
xyzsgfht
reenap
pppppppppppp
Now here I want to select only "abcd" - first 4 characters of the
entire column and copy it in other excel sheet. New sheet should
contain
abcd
xyzs
reen
pppp
as column.
How can I do that?
--
reena
------------------------------------------------------------------------
reena's Profile: http://www.excelforum.com/member.php...o&userid=30440
View this thread: http://www.excelforum.com/showthread...hreadid=506265