Macro problem

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/16/2005 by jim
'

'
Range("B9").Select
Selection.Cut
Range("F8").Select
ActiveSheet.Paste
Range("F10").Select
End Sub


Hello
How do I get this macro to start where it stops?
I want it to cut cell B9 then paste it to cell F8 then move to cell F10,
this works over & over.
I need this macro to cut a cell then move up one row & to the right 4
columns and paste then move back to where it started then move down 2 rows.

Thank You
 
Both below require NO selections

something like
for each c in range("b9:b" & cells(rows.count,"b").end(xlup).row)
c.copy c.offset(-1,4)
next

or for every other row this might work

for i= 1 to cells(rows.count,"a").end(xlup).row step 2
cells(i,"a").copy cells(i-1,"f")
next i
 
Jim

Try recording the macro with the "Relatiuve Reference" button enabled.

You will get different code like this.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/16/2005 by Gord Dibben
'

'
ActiveCell.Offset(3, 3).Range("A1").Select
Selection.Cut
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveSheet.Paste

End Sub

Note: you don't have to select things to work on them.

Range(Range("A1"), Range("A1").End(xlDown)).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.Paste

is equal to.....

Range(Range("A1"), Range("A1").End(xlDown)).Copy _
Destination:=Sheets("Sheet2").Range("A1")


Gord Dibben Excel MVP
 
Back
Top