| Set ExcelApp = CreateObject("Excel.Application") | | Set ExcelBook = ExcelApp.Workbooks.open("ExcelFile.XLS") | | Set ExcelSheet = ExcelBook.Worksheets("Sheet1") | | ExcelSheet.Activate | | RowCount = ExcelBook.ActiveSheet.UsedRange.Rows.Count | | For i = 1 to RowCount | | If CSTR(ExcelSheet.Cells(i,5)) = "早班" then MW = i | | If CSTR(ExcelSheet.Cells(i,5)) = "午班" then NW = i | | If CSTR(ExcelSheet.Cells(i,5)) = "晚班" then | | EW = i | | Exit For | | end if | | Next | | | | | | | | ExcelSheet.Range("I" & MW & ":I" & NW).Value = 哈哈 | | | | ExcelBook.CloseCOPY |
|