Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Delete empty rows in excel in b/w rows with values | Excel Worksheet Functions | |||
Application that separates Excel rows in new worksheets | Links and Linking in Excel | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | 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 | |||
macro to close excel application other than application.quit | Excel Programming |