close

I created a macro to delete the first 9 characters of a cell in a
particular column, now I want the macro to work on the rest of the
cells in that column down to cell 650. How do I do this??--
gmoexcel
------------------------------------------------------------------------
gmoexcel's Profile: www.excelforum.com/member.php...oamp;userid=23324
View this thread: www.excelforum.com/showthread...hreadid=509496Try recording a macro when you:
Select the range
data|text to columns
fixed width
(draw a line after the 9th character and remove any that excel guessed at)
Choose to skip the first field

I think you'll find this kind of macro works faster than looping through the
cells.

gmoexcel wrote:
gt;
gt; I created a macro to delete the first 9 characters of a cell in a
gt; particular column, now I want the macro to work on the rest of the
gt; cells in that column down to cell 650. How do I do this??
gt;
gt; --
gt; gmoexcel
gt; ------------------------------------------------------------------------
gt; gmoexcel's Profile: www.excelforum.com/member.php...oamp;userid=23324
gt; View this thread: www.excelforum.com/showthread...hreadid=509496

--

Dave Peterson

This is just sample code. I will start with Z100. This changes one cell:Sub Macro1()
Dim s As String
s = Cells(100, 26).Value
Cells(100, 26).Value = Right(s, Len(s) - 9)
End Sub

This starts with row 100 and runs down another 650 cells:Sub macro2()
Dim s As String
For i = 100 To 750
s = Cells(i, 26).Value
Cells(i, 26).Value = Right(s, Len(s) - 9)
Next
End Sub

--
Gary's Studentquot;gmoexcelquot; wrote:

gt;
gt; I created a macro to delete the first 9 characters of a cell in a
gt; particular column, now I want the macro to work on the rest of the
gt; cells in that column down to cell 650. How do I do this??
gt;
gt;
gt; --
gt; gmoexcel
gt; ------------------------------------------------------------------------
gt; gmoexcel's Profile: www.excelforum.com/member.php...oamp;userid=23324
gt; View this thread: www.excelforum.com/showthread...hreadid=509496
gt;
gt;

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()