|
请求高手帮忙将下面的VBA代码翻译成VSTO(C#)的
- Sub 提取数据()
- On Error Resume Next
- Dim wsh As Worksheet, i As Integer, brr(), j As Integer, arr
- For Each wsh In Worksheets
- If wsh.Name = "提取数据" Then GoTo 100
- j = wsh.Range("a65536").End(xlUp).Row
- arr = wsh.Range("a5:n" & j)
- k = k + UBound(arr)
- ReDim Preserve brr(1 To 14, 1 To k)
- For i = 1 To UBound(arr)
- If arr(i, 13) = "不限" Then
- n = n + 1
- brr(1, n) = arr(i, 1)
- brr(2, n) = arr(i, 2)
- brr(3, n) = arr(i, 3)
- brr(4, n) = arr(i, 4)
- brr(5, n) = arr(i, 5)
- brr(6, n) = arr(i, 6)
- brr(7, n) = arr(i, 7)
- brr(8, n) = arr(i, 8)
- brr(9, n) = arr(i, 9)
- brr(10, n) = arr(i, 10)
- brr(11, n) = arr(i, 11)
- brr(12, n) = arr(i, 12)
- brr(13, n) = arr(i, 13)
- brr(14, n) = arr(i, 14)
- End If
- Next
- 100:
- Next
- Sheets("提取数据").Range("a2").Resize(n, 14) = Application.WorksheetFunction.Transpose(brr)
- End Sub
复制代码
|
|