Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try going back to
activesheet.range("a4").select ActiveCell.Insert Shift:=xlShiftDown activesheet.paste as for inserting to the bottom ActiveSheet.UsedRange.Rows.Count gives you the last row with data in it adding one to that will give you the next row down just select that and paste "Stacie Fugate" wrote: Okay, that worked great! But, one problem.. how do I get it to insert the row instead of replacing what was currently in that row? Instead of replacing the row that was there, I just need it to add the new row to that list... either at the top or at the bottom. Thing of it is, the bottom row number varies constantly, it could have 5 rows, it could have 60 rows... how do I get it to know which row to go to? Additionally, I have 3 different sections on my spreadsheet, how can I get excel to recognize if a row is under Section 1, then move it to the next available empty row in Section 1 on the Tracking Tab? If my cursor is on a row in Section 2, then move this row to the next empty row in Section 2 on the Tracking Tab. Below is kinda an example of what my spreadsheet looks like. Both tabs look identical, the only difference is the data under the column header... WELL TYPE 1 INFORMATION Smith #1 County ST 1/13/05 Jones #2 County ST 1/14/05 WELL TYPE 2 INFORMATION Brown #3 County ST 1/16/05 WELL TYPE 3 INFORMATION Haynes #6 County ST 1/17/05 "nippetee" wrote: sometimes excel has no clue what sheet to do things coded even though it seems clear to coder... :) try put activesheet before that range line like this: ActiveSheet.Range("A4").Select This should work... "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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Button macro to move/delete active row | Excel Discussion (Misc queries) | |||
Any way to use toolbar button to delete cells and move cells "up"? | Excel Discussion (Misc queries) | |||
How can I delete a macro when the Delete button is not active? | Excel Worksheet Functions | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming | |||
Delete a custom button by holding down the ALT key and dragging the button off the toolbar | Excel Programming |