Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dar Dar is offline
external usenet poster
 
Posts: 25
Default Delete rows from outside of Excel application

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Delete rows from outside of Excel application

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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
Dar Dar is offline
external usenet poster
 
Posts: 25
Default Delete rows from outside of Excel application

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.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Delete empty rows in excel in b/w rows with values Dennis Excel Worksheet Functions 3 August 28th 07 04:15 PM
Application that separates Excel rows in new worksheets Shinra14 Links and Linking in Excel 1 May 25th 07 11:30 PM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
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 Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"