View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Button to move row and delete old row

it's possible either that the workbook is protected. check for worksheet
protection also try rows("4") and what is the exact error message you get


"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