ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell movement (https://www.excelbanter.com/excel-programming/317981-cell-movement.html)

Jeff Lavendol

cell movement
 
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.

Dmoney

cell movement
 
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


-----Original Message-----
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.
.


Ben

cell movement
 
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

"Jeff Lavendol" wrote:

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.



All times are GMT +1. The time now is 01:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com