ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can this be done? (https://www.excelbanter.com/excel-programming/365329-can-done.html)

Naesgn

Can this be done?
 

Im trying to automatically move a row to a new worksheet and out of the
current worksheet once the last column in that row reaches "today's"
date. Can this be done?


--
Naesgn
------------------------------------------------------------------------
Naesgn's Profile: http://www.excelforum.com/member.php...o&userid=35773
View this thread: http://www.excelforum.com/showthread...hreadid=555422


Irina

Can this be done?
 
Try the following code:
define in module:

Private ExlApp As ExlClass

At the beginning, for example in auto_open sub
should be:

Set ExlApp=new ExlClass

Then insert in you VBA project new class, name it ExlClass.
Class code is the following. Correct it, if needed.

Private Sub Class_Initialize()
Set Exl = ThisWorkbook.Application
End Sub

Private Sub Exl_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.index = 1 Then 'replace with your index
If Target.Column = 10 And _
Cells(Target.row, Target.Column).Value = Date Then
Target.EntireRow.Select
Selection.Cut
ActiveSheet.Paste _
Destination:=Worksheets("Sheet2").Range("A1:A1") 'change range
Target.Select
Application.CutCopyMode = False
End If
End If
End Sub

Regards, Irina


"Naesgn" wrote:


Im trying to automatically move a row to a new worksheet and out of the
current worksheet once the last column in that row reaches "today's"
date. Can this be done?


--
Naesgn
------------------------------------------------------------------------
Naesgn's Profile: http://www.excelforum.com/member.php...o&userid=35773
View this thread: http://www.excelforum.com/showthread...hreadid=555422




All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com