View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Stacie Fugate[_2_] Stacie Fugate[_2_] is offline
external usenet poster
 
Posts: 30
Default Button to move row and delete old row

So then, the code would be:

Private Sub MoveRow_Click()
ActiveCell.EntireRow.Copy
Worksheets("Tracking").Activate 'the other sheet
activesheet.rows("4:4").select
Selection.Insert Shift:=xlDown
Worksheets("Western").Activate 'back to the original
ActiveCell.EntireRow.Delete Shift:=xlShiftUp
End Sub



"ben" wrote:

i'm sorry i think i just realized what is wrong
use activesheet.rows("4:4").select

i run into this problem a lot


"Stacie Fugate" wrote:

Its still not working... Any suggestions? When I use that, it takes me back
to the debugger and highlights the Rows("4:4").Select line... I really dont
know what's wrong.

"ben" wrote:

before pasting do not use range("a4").select
try

Rows("4:4").Select
Selection.Insert Shift:=xlDown

"Stacie Fugate" wrote:

I've created a button at the top of a spreadsheet that says "Move Row to
Tracking Tab". When this button is clicked, I want it to move the current
row (where their cursor is), to the Tracking Tab, and add it either at the
top of the spreadsheet (under the header row) or to the very bottom, while at
the same time, it deletes the old row from the first sheet entirely. The
first cell that contains data on the Tracking Tab is A4. Everything above
that is the header. (And just in case you need to know, the first tab is
titled "Western", and they are the only 2 tabs in the workbook) I've tried
the following code, but cant get it to work out right. It's giving me fits
with the line "Range("A4").Select", and I'm not really sure why.

Here is the code I used:

Private Sub MoveRow_Click()
ActiveCell.EntireRow.Copy
Worksheets("Tracking").Activate 'the other sheet
Range("A4").Select
ActiveCell.Insert Shift:=xlShiftDown
Worksheets("Western").Activate 'back to the original
ActiveCell.EntireRow.Delete Shift:=xlShiftUp
End Sub