ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Macro problem (https://www.excelbanter.com/new-users-excel/17917-macro-problem.html)

Jim

Macro problem
 
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

















Don Guillett

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

--
Don Guillett
SalesAid Software

"Jim" wrote in message
...
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



















Gord Dibben

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


On Wed, 16 Mar 2005 10:14:46 -0700, "Jim" wrote:

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


















All times are GMT +1. The time now is 03:20 PM.

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