|
Public Function stockread(e())
Worksheets("数据输入").Select
Set readsheet1 = Sheets("数据输入")
e(1) = readsheet1.Range("k7").Value
e(2) = readsheet1.Range("e8").Value
e(3) = readsheet1.Range("e10").Value
e(4) = readsheet1.Range("e11").Value
e(5) = readsheet1.Range("e12").Value
e(6) = readsheet1.Range("e13").Value
e(7) = readsheet1.Range("e14").Value
e(8) = readsheet1.Range("e15").Value
e(9) = readsheet1.Range("e16").Value
e(10) = readsheet1.Range("e17").Value
e(11) = readsheet1.Range("e18").Value
e(12) = readsheet1.Range("h8").Value
e(13) = readsheet1.Range("h9").Value
e(14) = readsheet1.Range("h10").Value
e(15) = readsheet1.Range("h11").Value
e(16) = readsheet1.Range("h13").Value
e(17) = readsheet1.Range("h14").Value
e(18) = readsheet1.Range("h15").Value
e(19) = readsheet1.Range("h17").Value
e(20) = readsheet1.Range("h18").Value
e(21) = readsheet1.Range("k8").Value
e(22) = readsheet1.Range("k9").Value
e(23) = readsheet1.Range("k10").Value
e(24) = readsheet1.Range("k12").Value
e(25) = readsheet1.Range("k13").Value
e(26) = readsheet1.Range("k14").Value
e(27) = readsheet1.Range("k15").Value
e(28) = readsheet1.Range("k17").Value
e(29) = readsheet1.Range("k18").Value
End Function
Public Function selectfreecol(f)
Set readSheet2 = Worksheets("数据库")
readSheet2.Select
Dim i, c
For i = 1 To 100
c = Sheet2.Cells(2, i).Value
If IsEmpty(c) Then f = i
Next i
End Function
Public Sub tijiao()
Dim a(1 To 30) As String
Dim b As Integer
a(30) = stockread(e)
Set readsheet3 = Application.Worksheets("数据库")
o = selectfreecol(b)
readsheet3.Range(Cells(2, o), Cells(31, o)).Select
readsheet3.Activate
Dim k As Integer
Dim l As Integer
Dim o As Integer
For k = 1 To 30
l = k + 1
Worksheet.Cells(l, o).Select
Worksheet.Cells(l, o).Value = a(k)
Next k
End Sub
都有什么错误啊。怎么老是不行。
补充内容 (2013-11-11 13:16):
这是新编辑的
Public Sub tijiao()
Dim e(30)
Dim k As Integer
Dim l As Integer
Dim f As Integer
Dim c As String
Application.Goto Sheets(2).Range("d7:k18")
e(1) = Range("k7").Value
e(2) = Range("e8").V |
|