我主要是在寻找有关如何启动项目的指导。
Sprdsht 1 设置为一个表格,其中行包含该位置的特定数据,列包含参数(即 A:K= 名称、排放数据、型号等)。Sprdsht 2 被构造为具有多个框的表单。我正在尝试将数据从 sprdsht 1 导入到 sprdsht 2,并且想知道是否可以一次只导入一行数据以使用宏或 VBA 完成表单(即 F1:F11)。
如果是这样,代码看起来如何?
此外,使用 excel 是处理此功能的最佳方式还是其他程序(即 Access)会更好地工作?
以下是众多入门方法之一的示例:
Sub CopyInfo()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim sheet1 As Worksheet
Dim sheet2 As Worksheet
Dim rng1 As Range
Dim rng2 As Range
Set wb1 = Application.Workbooks("FirstWorkbook.xlsx")
Set wb2 = Application.Workbooks("OtherWorkbook.xlsx")
Set sheet1 = wb1.Sheets(1)
Set sheet2 = wb2.Sheets(1)
Set rng1 = sheet1.Range("A2:K2", Range("A2:K2").End(xlDown))
Set rng2 = sheet2.Range("F1:F11")
For i = 1 To rng1.Rows.Count
For j = 1 To 11
rng2(j, 1).Value = rng1(i, j).Value
Next
Call FunctionThatSubmitsTheFormInSheet2
Next
End Sub