ChatGPT操控Excel表格
用户提出excel需求,通过代码把他转化成像ChatGPT提问获取对应的宏代码,从返回值提取宏代码,然后用那个WPS模块运行宏代码
Sub FillColumns()
Dim i As Integer
Dim lastRow As Integer
lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To 20 Step 2
'确定当前组的起始行
Dim startRow As Integer
startRow = i
'分别填充第二列和第三列当前组的前两行
Cells(1, (i + 1) / 2 + 1) = Cells(startRow, 1)
Cells(2, (i + 1) / 2 + 1) = Cells(startRow + 1, 1)
Next i
End Sub