Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Move down the cells in a column

What is the code to move down the cells in a column one by one?

Thanks!

Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 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



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
move column data based on value of another column [email protected] Excel Programming 0 January 8th 07 04:05 PM
Move cells to another column based on value of cell [email protected] Excel Programming 0 December 28th 06 03:28 PM
how to move the cursor to column A after entering data column F tskaiser New Users to Excel 2 April 29th 06 02:28 PM
move contents of column C based on criteria related to column A Debra Excel Discussion (Misc queries) 2 December 27th 05 10:25 PM
how can I take 3 cells and move them to a different column into 1 manz77 Excel Discussion (Misc queries) 1 January 27th 05 09:39 PM


All times are GMT +1. The time now is 03:15 AM.

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"