Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
gmoexcel
 
Posts: n/a
Default How to make a macro run on the next cell


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: http://www.excelforum.com/member.php...o&userid=23324
View this thread: http://www.excelforum.com/showthread...hreadid=509496

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default How to make a macro run on the next cell

Try 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:

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: http://www.excelforum.com/member.php...o&userid=23324
View this thread: http://www.excelforum.com/showthread...hreadid=509496


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default How to make a macro run on the next cell

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 Student


"gmoexcel" wrote:


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: http://www.excelforum.com/member.php...o&userid=23324
View this thread: http://www.excelforum.com/showthread...hreadid=509496


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to find cell content in sheets and make sheet active Nigel Excel Discussion (Misc queries) 4 June 26th 14 02:38 PM
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
How do I make a cell equal to another cells value and not it's fo. TroutKing Excel Worksheet Functions 2 January 17th 05 06:15 PM
Make a macro of keystrokes. ie. F2,Shift & Home & right cursor,de. Ted Byrd Excel Worksheet Functions 1 December 29th 04 05:52 PM


All times are GMT +1. The time now is 09:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"