View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Woodi2 Woodi2 is offline
external usenet poster
 
Posts: 61
Default Macro to delete row

I am obviously quite an amateur at this. I'm not sure how I enter or use the
code than Don gave me

"Otto Moehrbach" wrote:

Your line:
ActiveCell.EntireRow.Cut
cuts the contents of the row. When you paste those contents you end up with
a blank row.
Your line:
Selection.Insert Shift:=xlDown
inserts another blank row.
The code that Don gave you should do what you want. Otto
"Woodi2" wrote in message
...
Otto, this code leaves a blank row every time I do it. You are correct
that
it deletes the row of the active cell but it does not move everything up.
Here is the complete code I have

ActiveCell.EntireRow.Cut
Sheets("Not SD Work").Select
Rows("3:3").Select
ActiveSheet.Paste
Rows("3:3").Select
Selection.Insert Shift:=xlDown
Range("A4:Q2500").Select
Selection.Sort Key1:=Range("L4"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A3").Select
Sheets("All Electrical Resp Work < 2010").Select
Application.CutCopyMode = False

"Otto Moehrbach" wrote:

I don't understand what you want to do. Your code:
ActiveCell.EntireRow.Delete
deletes the row of the active cell and moves everything below it up.
What
does this do that you don't want? HTH Otto
"Woodi2" wrote in message
...
Could anyone help with a Macro to delete a row.

My spreadsheet contains infomation that I review and then 'cut' the
data
from one worksheet and paste it in a new worksheet. One of several
different
ones actually

This leaves a blank row in the original worksheet. The code I use for
this
is ActiveCell.EntireRow.Delete

I cannot specify the row to delete in the code as the sheet is filtered
so
I
would like to delete the row I have removed the data from and shift the
remining data up. i.e. Rows.Delete Shift:=xlUp. The only problem with
this
code is the entire sheet gets deleted. I have tried ActiveRow and
ActiveRows
but VBA doesnt appear to recognize this.