View Single Post
  #19   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Copy range if column N is empty

Damn, I forgot the On Error statement (needed in case all of Column N is
blank)...

Sub ject()
On Error Resume Next
Sheets("Carryovers").Range("N2:N" & Rows.Count). _
SpecialCells(xlCellTypeConstants).EntireRow.Delete
End Sub

--
Rick (MVP - Excel)



"Rick Rothstein" wrote in message
...
Also need a macro to clear data from the carryover sheet where
column N has a value. This macro will be run before the one to
move the data from sales.


When you say "clear", I am assuming you mean to delete the entire row so
that no gaps appear in your data rows. You can use this macro to delete
the rows of data on the Carryovers sheet where Column N has a value placed
in it...

Sub ject()
Sheets("Carryovers").Range("N2:N" & Rows.Count). _
SpecialCells(xlCellTypeConstants).EntireRow.Delete
End Sub

--
Rick (MVP - Excel)



"Rick Rothstein" wrote in message
...
Here is a revision for Sub Terranean for you to try...

Sub Terranean()
Dim LastRow As Long
LastRow = Sheets("Carryovers").Cells.Find(What:="*", _
SearchOrder:=xlRows, SearchDirection:=xlPrevious, _
LookIn:=xlValues).Row
On Error Resume Next
Intersect(Sheets("Sales").Columns("A:T"), Sheets("Sales"). _
Columns("N").SpecialCells(xlCellTypeBlanks). _
EntireRow).Copy Sheets("Carryovers").Cells(LastRow + 1, "A")
End Sub

--
Rick (MVP - Excel)


"ajm1949" wrote in message
...
Hi Rick
Sorry I wasn't clear enough.

The Sub Terranean macro is the quickest but we need to put the data
after
some existings data. That's the one that I hope can be modified.

Also need a macro to clear data from the carryover sheet where column N
has
a value. This macro will be run before the one to move the data from
sales.


Cheers

Alan