if m.tlLockHeaderRow && we need to prevent headers from modifying ** Code from Borislav Borissov loSheet.UsedRange.select loExcel.Selection.Locked = .f. && First we need to UNLOCK all cells loExcel.Rows(m.lnLines + m.lnOffset).Select && Select header row of the sheet loExcel.Selection.Locked = .t. && Lock Cells in first row loExcel.ActiveWorkbook.ActiveSheet.Protect(,.t.,,.t.) endifAnd it's good I posted because I see I have wrong comments on the loExcel.Selection.Locked = .t. line.