Dear DS, Please try it..
*Private Sub CommandButton1_Click() Dim i As Integer Dim dt As Date i = Cells(Rows.Count, "A").End(xlUp).Row + 1 dt = Me.DTPicker1 With Application.WorksheetFunction If .WeekNum(dt) > (.WeekNum(Date) - 1) Then Cells(i, 1) = Me.DTPicker1.Value Else MsgBox "Restricted Last week Entery", vbCritical End If End With End Sub *see attached sheet, hope it will help to you. On Mon, Jul 16, 2012 at 10:18 AM, Dhartikumar Sahu <dhartiku...@gmail.com>wrote: > Hi Experts > > Required VBA Code for restrict Previous Week Data Entry to Users. > > -- > > *Regards,* > > *Dhartikumar Sahu* > > Sr.Database Manager - Institutional Equities > > * **IDBI Capital Markets Services Ltd* > > 5th Floor, Mafatlal Centre | Nariman Point | Mumbai – 21 > > Board: +91 22 4322 1212 | Dir: +91 22 4322 1169 | Cell: +91 77383 63450 > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > ------------------------------------------------------------------------------------------------------ > To post to this group, send email to excel-macros@googlegroups.com > > To unsubscribe, send a blank email to > excel-macros+unsubscr...@googlegroups.com -- Thanks & regards, Noorain Ansari www.noorainansari.com www.excelmacroworld.blogspot.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com
Dharti_Query.xlsm
Description: Binary data