Re: $$Excel-Macros$$ Private sub selection-change preventing copy paste

2011-06-24 Thread Rajesh K R
Hi Vasant Thanks for your reply.I don't know exactly what is flag in VBA, however I think it is something like a condition. Within in my limitation I just modify the code. Private Sub Worksheet_SelectionChange(ByVal Target As Range) if range("AH1")<>0 then Application.EnableEvents = False Columns(

Re: $$Excel-Macros$$ Private sub selection-change preventing copy paste

2011-06-23 Thread Vasant
You can use a flag, public boolean variable which should be set to true by default, the code in worksheets should run only if if the flag is true. When the copy code is executed the flag has to be set to false which will prevent the code from execution. After the copy code is executed the flag c

Re: $$Excel-Macros$$ Private sub selection-change preventing copy paste

2011-06-23 Thread Rajesh K R
Hi Vasant Thank you very much, excellent work. I posted the query two times before this but I din't get a proper answer on that time.but this time u did it well. I have one more problem in that file. this file is used for marking attendance of employees, I have an another page for the settlement of

Re: $$Excel-Macros$$ Private sub selection-change preventing copy paste

2011-06-22 Thread Vasant
pls try this Sub locksheet() Dim DataRng As Range, DataFilledRange As Range Dim WkSht As Worksheet Set DataRng = ThisWorkbook.Worksheets("April").Range("C3:F7") Set WkSht = ThisWorkbook.Worksheets("April") WkSht.Unprotect With WkSht.Cells .Locked = fase .FormulaHidden = False End With For Each

Re: $$Excel-Macros$$ Private sub selection-change preventing copy paste

2011-06-22 Thread Rajesh K R
Hi Vasant Thanks for the code, its working well I need a condition in this the columns must not be locked in case all the data entry cells filled eg; A B C D E F G H I S N NAME1 2 3 4 5 6 7 3

Re: $$Excel-Macros$$ Private sub selection-change preventing copy paste

2011-06-22 Thread Vasant
pls try this this will lock the populated cells in the range C3:AA5 in sheet 'april' Sub locksheet() Dim DataRng As Range, DataFilledRange As Range Dim WkSht As Worksheet Set DataRng = ThisWorkbook.Worksheets("April").Range("C3:AA5") Set WkSht = ThisWorkbook.Worksheets("April") WkSht.Unprotect Fo