I have data acquisition software (DASYLab) that is gathering certain data for me. I have the data programmed to dump in to an excel file from the acquisition software. Once in the excel file, it is not allowed to be edited in any way. The problem I am running across is that when running my VBA that locks the selected group of cells where the data dumps, it isnt triggered. It only triggers once the actual cell is physically selected and any info is put in the cell. Once clicked out of, the cell that was just edited is locked. I cannot figure out how to trigger the cells to lock upon data dump.
The data is automatically imported via DDE from the data acquisition software to a saved workbook template. After batch production is complete and it is the end of the day, and the technician selects "stop recording" in the software, and it is programmed to automatically "save as" the template with the date/time. After the "save as" copy is stored, the template is closed without saving changes to the template, thus returning it back to a blank template.
Please Help! My Code is
[MENTION]1 Private Sub Worksheet_Change(ByVal Target As Range)
2 Dim xRg As Range
3 On Error Resume Next
4 Set xRg = Intersect(Range("A1:E300"), Target)
5 If xRg Is Nothing Then Exit Sub
6 Target.Worksheet.Unprotect Password:="123"
7 xRg.Locked = True
8 Target.Worksheet.Protect Password:="123"
9 End Sub[/MENTION]
The data is automatically imported via DDE from the data acquisition software to a saved workbook template. After batch production is complete and it is the end of the day, and the technician selects "stop recording" in the software, and it is programmed to automatically "save as" the template with the date/time. After the "save as" copy is stored, the template is closed without saving changes to the template, thus returning it back to a blank template.
Please Help! My Code is
[MENTION]1 Private Sub Worksheet_Change(ByVal Target As Range)
2 Dim xRg As Range
3 On Error Resume Next
4 Set xRg = Intersect(Range("A1:E300"), Target)
5 If xRg Is Nothing Then Exit Sub
6 Target.Worksheet.Unprotect Password:="123"
7 xRg.Locked = True
8 Target.Worksheet.Protect Password:="123"
9 End Sub[/MENTION]