Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have following code repeated in Four sheets ina workbbok containg ten sheets. and some other code in another four sheets Is there a way that I can avoid this repetation? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo doTHIS Application.EnableEvents = False If Target.Address = "$D$4" Then FindMatch End If doTHIS: Application.EnableEvents = True End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$C$10" Then Set rng = Range("C4:C8") On Error GoTo Dotry Application.EnableEvents = 0 If Application.CountA(rng) < 5 Then MsgBox "Enter All Records!", vbOKOnly, _ "Invalid Record found" ActiveSheet.Unprotect Password:="adfm" rng.SpecialCells(xlBlanks)(1).Select ActiveSheet.Protect Password:="adfm" ActiveSheet.EnableSelection = xlUnlockedCells Exit Sub Else DoIt End If End If Dotry: Application.EnableEvents = True End Sub TIA Soniya |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code in certain sheets | Excel Worksheet Functions | |||
sum across range of sheets for a cost code | Excel Worksheet Functions | |||
Code to hide sheets | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
Formating Sheets made in Code | Excel Discussion (Misc queries) |