- ©«¤l
- 76
- ¥DÃD
- 17
- ºëµØ
- 0
- ¿n¤À
- 95
- ÂI¦W
- 0
- §@·~¨t²Î
- windowsxp
- ³nÅ骩¥»
- office2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2016-8-19
- ³Ì«áµn¿ý
- 2021-5-5
|
§Ú¹Á¸Õ¥Î¥H¤U¥N½X¸Ñ¥X¨Ó¤F
¤èªk¦³ÂI²Â- Sub autonumber()
- Dim arr, i%
- Dim myCon As Object, myRs As Object, sql$
-
- USE = Worksheets("¤u§@ªí1").Range("A65536").End(xlUp).Row
- Worksheets("¤u§@ªí1").Range("A2:C" & USE).ClearContents
- Set myCon = CreateObject("ADODB.Connection")
- Set myRs = CreateObject("ADODB.Recordset")
- myCon.Open "provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & ThisWorkbook.Path & "\test.accdb;"
-
- sql = "SELECT * FROM ¸ê®Æªí1 ORDER BY ¸ê®Æªí1.½s¸¹;"
- Set myRs = myCon.Execute(sql)
- Do While Not myRs.EOF
- vl = myRs.Fields(2).Value
- Sheets(1).Cells(2, 1) = vl + 1
- Sheets(1).Cells(3, 1) = vl + 2
- Sheets(1).Cells(4, 1) = vl + 3
- Sheets(1).Cells(5, 1) = vl + 4
- Sheets(1).Cells(6, 1) = vl + 5
- myRs.MoveNext
- Loop
-
- Application.EnableEvents = True
- End Sub
½Æ»s¥N½X |
|