Delete rows from outside of Excel application
SOmething like
Set xlApp = GetObject(, "Excel.Application")
With xlApp
For Each oWS In xlApp.Workbooks("Personal.xls").Worksheets
cLastRow = oWS.Cells(oWS.Rows.Count, "D").End(xlUp).Row
For i = cLastRow To 1 Step -1
If oWS.Cells(i, "D").Value = Date Then
oWS.Cells(i, "D").EntireRow.Delete
End If
Next i
Next oWS
End With
juust replace the workbook name with your name
--
HTH
RP
(remove nothere from the email address if mailing direct)
"dar" wrote in message
...
I'll give this a try, but how do I move to the next worksheets to do the
same
thing
"Bob Phillips" wrote:
A starter
set xlApp = GetObject(,"Excel.Application")
with xlapp.Activesheet
cLastRow = .Cells(.Rows.Count,"D").End(xlUp).Row
For i = cLastRow To 1 Step -1
if .Cells(i,"D").Value = Date Then
.Cells(i,"D").Entirerow.Delete
End If
Next i
End With
--
HTH
RP
(remove nothere from the email address if mailing direct)
"dar" wrote in message
...
I have a workbook with several worksheets each containing Column D as
a
Date.
I need to be able to delete any rows with a date earlier than Now().
I
would like to be able to do that from Access if possible.
If I need to add a control to Excel, please include code for that
control.
Thank you.
|