Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Repeat code over 300 rows

How can I alter this code so that if performs the function not just on row 2
but all the way down through row 300. I Am sure I could repeat the code for
each of the 300 rows but I bet there is a better way.

Private Sub Worksheet_Calculate()
Me.Range("A2").Value = Me.Range("D2")
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Repeat code over 300 rows

for i=2 to 300
me.cells(i,1).value=me.cells(i,4).value
next i

though it's not clear from your post whether A3 should equal D2 or D3....


Tim



"Patrick Simonds" wrote in message
...
How can I alter this code so that if performs the function not just on row
2 but all the way down through row 300. I Am sure I could repeat the code
for each of the 300 rows but I bet there is a better way.

Private Sub Worksheet_Calculate()
Me.Range("A2").Value = Me.Range("D2")
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Repeat code over 300 rows

Sorry

Me.Range("A2").Value = Me.Range("D2")
A3 D3
A4 A5
A6 A6

All the way down to row 300



"Tim Williams" <saxifrax at pacbell dot net wrote in message
...
for i=2 to 300
me.cells(i,1).value=me.cells(i,4).value
next i

though it's not clear from your post whether A3 should equal D2 or D3....


Tim



"Patrick Simonds" wrote in message
...
How can I alter this code so that if performs the function not just on
row 2 but all the way down through row 300. I Am sure I could repeat the
code for each of the 300 rows but I bet there is a better way.

Private Sub Worksheet_Calculate()
Me.Range("A2").Value = Me.Range("D2")
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Repeat code over 300 rows

Having tried your cod, it does exactly what I need. Thank you


"Tim Williams" <saxifrax at pacbell dot net wrote in message
...
for i=2 to 300
me.cells(i,1).value=me.cells(i,4).value
next i

though it's not clear from your post whether A3 should equal D2 or D3....


Tim



"Patrick Simonds" wrote in message
...
How can I alter this code so that if performs the function not just on
row 2 but all the way down through row 300. I Am sure I could repeat the
code for each of the 300 rows but I bet there is a better way.

Private Sub Worksheet_Calculate()
Me.Range("A2").Value = Me.Range("D2")
End Sub





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Repeat code over 300 rows

Hi Patrick,

Me.Range("A2:A301").Value = Me.Range("D2:D301").Value

The Me qualifier assumes code is in a Worksheet module.

Regards,
Peter T

"Patrick Simonds" wrote in message
...
How can I alter this code so that if performs the function not just on row

2
but all the way down through row 300. I Am sure I could repeat the code

for
each of the 300 rows but I bet there is a better way.

Private Sub Worksheet_Calculate()
Me.Range("A2").Value = Me.Range("D2")
End Sub






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
printing issue - want to repeat two rows and also 5 rows in column cliffykat Excel Discussion (Misc queries) 0 August 29th 07 10:36 PM
how to repeat rows at the bottom while using the rows repeat at to Rows to repeat at the bottom Setting up and Configuration of Excel 1 August 31st 05 02:06 PM
Title Cut Off if Rows to Repeat & Columns to Repeat are Both Selec unibaby Excel Discussion (Misc queries) 2 August 24th 05 04:29 PM
Unable to select rows in the repeat rows on top option Noppie Excel Discussion (Misc queries) 2 December 28th 04 03:17 PM
repeat code until row 24 Josh[_9_] Excel Programming 3 April 30th 04 06:36 PM


All times are GMT +1. The time now is 05:44 PM.

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

About Us

"It's about Microsoft Excel"