Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default Macro to stop at the end of a worksheet

Hi

I'm writing a macro that I wish to go row by row through the worksheet until
it get to the end and then stops. It is a bit complex, so I won't try and
explain what I'm doing, but I've got about 30 workbooks with a few thousand
rows each.

Any suggestions on how to stop at the end if I use a similar way of moving
around as the following example (this example is moving by column, whereas
I'll want to work on each row then move down a row, moving by row.)

Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=RC[-1]*100"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*100"
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select

Many thanks for your help.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Macro to stop at the end of a worksheet

With ActiveCell
.Offset(0, 1).Resize(.End(xlDown).Row - .Row + 1).FormulaR1C1 =
"=RC[-1]*100"
End With


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mark" wrote in message
...
Hi

I'm writing a macro that I wish to go row by row through the worksheet
until it get to the end and then stops. It is a bit complex, so I won't
try and explain what I'm doing, but I've got about 30 workbooks with a few
thousand rows each.

Any suggestions on how to stop at the end if I use a similar way of moving
around as the following example (this example is moving by column, whereas
I'll want to work on each row then move down a row, moving by row.)

Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=RC[-1]*100"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*100"
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select

Many thanks for your help.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default Macro to stop at the end of a worksheet

Many thanks Bob

I'll give it a try

"Bob Phillips" wrote in message
...
With ActiveCell
.Offset(0, 1).Resize(.End(xlDown).Row - .Row + 1).FormulaR1C1 =
"=RC[-1]*100"
End With


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Mark" wrote in message
...
Hi

I'm writing a macro that I wish to go row by row through the worksheet
until it get to the end and then stops. It is a bit complex, so I won't
try and explain what I'm doing, but I've got about 30 workbooks with a
few thousand rows each.

Any suggestions on how to stop at the end if I use a similar way of
moving around as the following example (this example is moving by column,
whereas I'll want to work on each row then move down a row, moving by
row.)

Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=RC[-1]*100"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*100"
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select

Many thanks for your help.





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 - Stop Recording Phil vK Excel Discussion (Misc queries) 4 May 23rd 07 07:03 PM
Macro - Stop Recording toolbar Epinn New Users to Excel 4 September 7th 06 05:56 PM
How do I stop a Macro from running? JulianB Excel Worksheet Functions 1 April 10th 06 10:33 PM
Macro to stop at a certain tab and does not go to the next one. [email protected] Excel Worksheet Functions 3 March 16th 06 01:11 AM
stop macro from flashing sheets frendabrenda1 Excel Discussion (Misc queries) 3 October 11th 05 09:55 PM


All times are GMT +1. The time now is 02:58 PM.

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"