你好老师,像图中选定后,点按钮自动填充1、2、3……

此主题相关图片如下:screenshot_20240618_100140_cn.wps.moffice_eng_edit_1132977509053159.jpg

代码应该怎么写啊

With Tables("表A")dim k as integer = 1
For i as Integer = .TopPosition+1 To .BottomPosition
.Rows(i)("某列") = k
k=k+1
Next
End With
此主题相关图片如下:示例.png

按钮的代码如下:
Dim t As WinForm.Table = e.Form.Controls("Table1")
Dim t1 As Table = t.Table
Dim j As Integer = 1
For i As Integer = t1.TopRow To t1.BottomRow
t1.Rows(i)("第一列") = j
j = j + 1
Next
[此贴子已经被作者于2024/6/18 10:35:36编辑过]