How to program move one cell down and copy?

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hi All:

I am new to programming macros in Excel. I would like a simple macro that
goes to the next cell in a column that has data and copy it then look for the
next one and so one. Any suggestions would be great. Thank you.

Gary
 
What do you want to do with the copied cell? Its a simple macro to write but
what happens with the copied cell will affect the code in a big way.
 
I will be pasting it in a separate database

fishonspeed said:
What do you want to do with the copied cell? Its a simple macro to write but
what happens with the copied cell will affect the code in a big way.
 
This will move any data from all used cells on sheet1 column1 to another
cell on sheet2 column1. Just change the destinations to fit your needs.

Sub CellMover()
Dim RowNumber
RowNumber = 1
'Checks to make sure there is a value in the cell.
Do While Worksheets("Sheet1").Cells(RowNumber, 1).Value <> ""
'Makes the appropriate cell on Sheet2 the same as on Sheet1.
Worksheets("Sheet2").Cells(RowNumber, 1).Value =
Worksheets("Sheet1").Cells(RowNumber, 1).Value
'Increases the row.
RowNumber = RowNumber + 1
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top