![]() |
Move down the cells in a column
What is the code to move down the cells in a column one by one?
Thanks! Steve |
Move down the cells in a column
What is the code to move down the cells in a column one by one?
Two different approaches to do the same thing... Sub TestCode1() Dim R As Range For Each R In Range("A1:A20") ' Your code goes here in ' place of the following R.Value = R.Row Next End Sub Sub TestCode2() Dim X As Long For X = 1 To 20 ' Your code goes here in ' place of the following Range("B" & CStr(X)).Value = X Next End Sub Rick |
Move down the cells in a column
Rick,
Double thanks here and thanks for the code to move through worksheets! Steve "Rick Rothstein (MVP - VB)" wrote in message ... What is the code to move down the cells in a column one by one? Two different approaches to do the same thing... Sub TestCode1() Dim R As Range For Each R In Range("A1:A20") ' Your code goes here in ' place of the following R.Value = R.Row Next End Sub Sub TestCode2() Dim X As Long For X = 1 To 20 ' Your code goes here in ' place of the following Range("B" & CStr(X)).Value = X Next End Sub Rick |
All times are GMT +1. The time now is 01:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com