大神老师,如何选定单元格能连续左移和右移,也就是能通过按钮点击能左移或右移,调整专业顺序,专业代码和专业名称一起移动,求按钮点击代码,感谢大神老师
此主题相关图片如下:123.jpg
[此贴子已经被作者于2024/5/30 21:10:08编辑过]
左移
dim t as table = tables("表A")
dim r as row = t.current
dim n as integer = t.colsel
dim c as col = t.cols(n)
if c.name like "*专业_*" andalso not(c.name like "第一专业_*") then
if c.name like "*_专业名称" then
n = n -1
c = t.cols(n)
end if
dim s1 as string = r(n-2)
dim s2 as string = r(n-1)
r(n-2) = r(n)
r(n-1) = r(n+1)
end if
非常感谢老师,那么右移怎么改,全指望你啦dim t as table = tables("表A")
dim r as row = t.current
dim n as integer = t.colsel
dim c as col = t.cols(n)
if c.name like "*专业_*" andalso not(c.name like "第六专业_*") then
if c.name like "*_专业名称" then
n = n -1
c = t.cols(n)
end if
dim s1 as string = r(n-2)
dim s2 as string = r(n-1)
r(n-2) = r(n)
r(n-1) = r(n+1)
r(n) = s1
r(n+1) = s2
end if
你真的是一个好老师!!!! Dim t As Table = Tables("填报表")
Dim r As Row = t.current
Dim n As Integer = t.colsel
Dim c As Col = t.cols(n)
If c.name Like "*专业_*" AndAlso not(c.name Like "第六专业_*") Then
If c.name Like "*_专业名称" Then
n = n -1
c = t.cols(n)
End If
Dim s1 As String = r(n+2)
Dim s2 As String = r(n+3)
r(n+2) = r(n)
r(n+3) = r(n+1)
r(n) = s1
r(n+1) = s2
End If
With CurrentTable
.Current.Move(.Position - 1)
End With
这个代码!但要除了批次和序号不动,只动其它怎么改,谢谢
上移是这个代码
With CurrentTable
.Current.Move(.Position - 1)
End With
下移是+1,但要除了批次和序号内容不动,只移动其它行内容怎么改,谢谢