- function test(){
- Range("b3:br4","b6:br17").ClearContents()
- Range("b9:br29").ClearContents()
- let [year , month ] = Range("a1").Value2.match(/\d+/g), dateArr = []
- let n = new Date( year , month, 0).getDate()
- let weekdays = [ null,"星期一","星期二","星期三","星期四","星期五",null]
- let weekindexs = [0,1,2,3,4,5,6]
- for (let i = 1 ; i <= n ; i ++){
- let weekdayindex = new Date(year,month-1,i).getDay()
- dateArr.push([ month +"月" + i + "日" , weekdays[weekdayindex]])
- }
- dateArr = dateArr.filter(v=>v[1])
- let k = 0
- for(let i in dateArr){
- Cells(3 , 3 * i + 2).Value2 = dateArr[i][0]
- Cells(4 , 3 * i + 2).Value2 = dateArr[i][1]
- if (i == 0){
- Cells(6,2).Resize(2,3).Value2 = [[3,5,5],[3,5,5]]
- } else if(dateArr[i-1][1] != "星期五"){
- Cells(6+ k * 2,3 * i + 2).Resize(2,3).Value2 = [[3,5,5],[3,5,5]]
- }else{
- k++
- Cells(6 + k * 2,3 * i + 2).Resize(2,3).Value2 = [[3,5,5],[3,5,5]]
- }4
- Cells(19,3 * i + 2).Resize(4,3).Value2 = Array(4).fill([3,5,0])
- Cells(23,3 * i + 2).Resize(7,3).Value2 = Array(7).fill([3,5,5])
- }
-
- }
复制代码
|