cell movement

  • Thread starter Thread starter Jeff Lavendol
  • Start date Start date
J

Jeff Lavendol

This is my first attempt at a macro. All I want to do is take data
from one sheet and put it in a second sheet. With each time the
second sheet is updated, I want to get the data in the next cell from
the first sheet. How do I write a macro to point to a different
sheet, one cell down.

I hope I am making sense. It is a depreciation detail schedule that I
am working with and want to update a summary sheet without having to
manually change the value in all the cells on the summary sheet.
 
sheets("sheet1").select
range("A1:d1").copy ''copy the data u want
sheets("sheet2").select
LastRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
''finds the last row in column 1
Rows(lastrow).Select ''selects the row
ActiveCell.PasteSpecial ''paste the copied data
 
Jeff,

use the cells command

sub switchdata()

for r=1 to 100
for c=1 to 100
'r is for rows
'c is for columns
oldval = sheet1.cells(r,c).value
sheet2.cells(r,c).value = oldval
next
next
end sub
substitute for r and c where you would like the data copied from and
applied to

ben
 

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