Excel onentLength,ColumnDatePosition(0)-ReferenceRangeStart) 初始数组(数组长度,2)=中间(组件内容(k),列日期位置(j),10) 初始阵列(阵列长度,2)=CDate(初始阵列(阵列长度,2)) 初始数组长度(ArrayLength,3)=中间(ComponentContent(k),ColumnDatePosition(j)+(i-1)*ComponentLength,ComponentLength-ColumnDatePosition(j)-2) ArrayLength=ArrayLength+1 如果结束 如果结束
下一个i更改为单间距字体将显示数据被转换为4个空格分隔的列 使用Excel onentLength,ColumnDatePosition(0)-ReferenceRangeStart) 初始数组(数组长度,2)=中间(组件内容(k),列日期位置(j),10) 初始阵列(阵列长度,2)=CDate(初始阵列(阵列长度,2)) 初始数组长度(ArrayLength,3)=中间(ComponentContent(k),ColumnDatePosition(j)+(i-1)*ComponentLength,ComponentLength-ColumnDatePosition(j)-2) ArrayLength=ArrayLength+1 如果结束 如果结束,excel,ms-access,vba,Excel,Ms Access,Vba,下一个i更改为单间距字体将显示数据被转换为4个空格分隔的列 使用Range.TextToColumns()进行拆分,使用WorksheetFunction.Transpose(.UsedRange.Value)进行数据转换,我们得到了一个标准表,该表有11列3行 +------------------------+--------------+-------------------+-------------------------+-----------+------------------
Range.TextToColumns()
进行拆分,使用WorksheetFunction.Transpose(.UsedRange.Value)
进行数据转换,我们得到了一个标准表,该表有11列3行
+------------------------+--------------+-------------------+-------------------------+-----------+-----------------------+---------------------------+-----------------------------+-------------------------------+----------------------------+----------------+---------------------------+---------------------+--------------------------+-----------------------+------------------------+---------------------+----------------------+-----------------------+-------------------------+-----------------+-----------------------+-----------------+------------------------+----------------------+------------------+---------------+-------------------------+-----------------+----------------------+------------------------+-------------------+----------------------+----------------------+---------------+---------------+--------------+
| Component | Color, Urine | Appearance, Urine | Specific Gravity, Urine | Urine pH | Protein Semiquant, UA | Glucose, Urine, Semiquant | Ketones, Urine, Qualitative | Bilirubin, Urine, Qualitative | Hemoglobin Pigments, Urine | Nitrite, Urine | Leukocyte Esterase, Urine | Urobilinogen, Urine | White Blood Cells, Urine | White Blood Cells, UA | Red Blood Cells, Urine | Red Blood Cells, UA | Hyaline Casts, Urine | Granular Casts, Urine | Epithelial Cells, Urine | Bacteria, Urine | Mucous Threads, Urine | Crystals, Urine | White Blood Cell Count | Red Blood Cell Count | Hemoglobin | Hematocrit | Mean Corpuscular Volume | Mean Corpus Hgb | Mean Corpus Hgb Conc | RBC Distribution Width | Platelet Count | Mean Platelet Volume | Nucleated RBC Number | Neutrophil % | Lymphocytes % | Monocyte % |
+------------------------+--------------+-------------------+-------------------------+-----------+-----------------------+---------------------------+-----------------------------+-------------------------------+----------------------------+----------------+---------------------------+---------------------+--------------------------+-----------------------+------------------------+---------------------+----------------------+-----------------------+-------------------------+-----------------+-----------------------+-----------------+------------------------+----------------------+------------------+---------------+-------------------------+-----------------+----------------------+------------------------+-------------------+----------------------+----------------------+---------------+---------------+--------------+
| Latest Ref Rng & Units | | | 1.003 - 1.030 | 4.6 - 8.0 | Negative | Negative mg/dL | Negative | Negative | Negative | Negative | Negative | 0.2 - 1.0 mg/dL | 0 - 5 /[HPF] | 0 - 27 /uL | 0 - 5 /[HPF] | 0 - 27 /uL | 0 - 1 /[LPF] | None seen /[LPF] | /[HPF] | None-few /[HPF] | None-few /[LPF] | None-few /[HPF] | 4.50 - 11.00 K/cu mm | 4.00 - 5.20 M/cu mm | 12.0 - 15.0 g/dL | 36.0 - 46.0 % | 80.0 - 100.0 fL | 26.0 - 34.0 pg | 31.0 - 37.0 g/dL | 11.5 - 14.5 % | 150 - 350 K/cu mm | 9.2 - 12.7 fL | 0.00 - 0.01 K/cu mm | 40.0 - 70.0 % | 24.0 - 44.0 % | 2.0 - 11.0 % |
| 12/19/2016 | Yellow | Clear | 1.012 | 6 | Negative | Negative | Negative | Negative | Small (A) | Negative | Moderate (A) | <=1.0 | 0 | 1 | 1 | 3 | 0 | 0 | <1 | None | Rare | None | | | | | | | | | | | | | | |
| 1/24/2017 | | | | | | | | | | | | | | | | | | | | | | | 1.82 (L) | 4.71 | 12.6 | 39.3 | 83.4 | 26.8 | 32.1 | 13.1 | 165 | 12.5 | 0 | 42.4 | 37.9 | 16.5 (H) |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+------------------------+--------------+-------------------+-------------------------+-----------+-----------------------+---------------------------+-----------------------------+-------------------------------+----------------------------+----------------+---------------------------+---------------------+--------------------------+-----------------------+------------------------+---------------------+----------------------+-----------------------+-------------------------+-----------------+-----------------------+-----------------+------------------------+----------------------+------------------+---------------+-------------------------+-----------------+----------------------+------------------------+-------------------+----------------------+----------------------+---------------+---------------+--------------+
这将使数据更易于处理。至于让它进入Access,还有比复制和粘贴更好的方法。我建议您学习如何使用Adodb.Recordset.AddNew分享您迄今为止尝试过的代码。“未成功”意味着什么-错误消息、错误结果、什么都没有发生?您为调试做了哪些工作?您需要描述具体的问题,而不仅仅是发布代码询问“哪里出了问题”。查看此站点中的代码以获取上述代码的示例,我能够以我想要的方式将数据获取到剪贴板中,但我无法确定如何将其从剪贴板获取到access表中。
+------------------------+--------------+-------------------+-------------------------+-----------+-----------------------+---------------------------+-----------------------------+-------------------------------+----------------------------+----------------+---------------------------+---------------------+--------------------------+-----------------------+------------------------+---------------------+----------------------+-----------------------+-------------------------+-----------------+-----------------------+-----------------+------------------------+----------------------+------------------+---------------+-------------------------+-----------------+----------------------+------------------------+-------------------+----------------------+----------------------+---------------+---------------+--------------+
| Component | Color, Urine | Appearance, Urine | Specific Gravity, Urine | Urine pH | Protein Semiquant, UA | Glucose, Urine, Semiquant | Ketones, Urine, Qualitative | Bilirubin, Urine, Qualitative | Hemoglobin Pigments, Urine | Nitrite, Urine | Leukocyte Esterase, Urine | Urobilinogen, Urine | White Blood Cells, Urine | White Blood Cells, UA | Red Blood Cells, Urine | Red Blood Cells, UA | Hyaline Casts, Urine | Granular Casts, Urine | Epithelial Cells, Urine | Bacteria, Urine | Mucous Threads, Urine | Crystals, Urine | White Blood Cell Count | Red Blood Cell Count | Hemoglobin | Hematocrit | Mean Corpuscular Volume | Mean Corpus Hgb | Mean Corpus Hgb Conc | RBC Distribution Width | Platelet Count | Mean Platelet Volume | Nucleated RBC Number | Neutrophil % | Lymphocytes % | Monocyte % |
+------------------------+--------------+-------------------+-------------------------+-----------+-----------------------+---------------------------+-----------------------------+-------------------------------+----------------------------+----------------+---------------------------+---------------------+--------------------------+-----------------------+------------------------+---------------------+----------------------+-----------------------+-------------------------+-----------------+-----------------------+-----------------+------------------------+----------------------+------------------+---------------+-------------------------+-----------------+----------------------+------------------------+-------------------+----------------------+----------------------+---------------+---------------+--------------+
| Latest Ref Rng & Units | | | 1.003 - 1.030 | 4.6 - 8.0 | Negative | Negative mg/dL | Negative | Negative | Negative | Negative | Negative | 0.2 - 1.0 mg/dL | 0 - 5 /[HPF] | 0 - 27 /uL | 0 - 5 /[HPF] | 0 - 27 /uL | 0 - 1 /[LPF] | None seen /[LPF] | /[HPF] | None-few /[HPF] | None-few /[LPF] | None-few /[HPF] | 4.50 - 11.00 K/cu mm | 4.00 - 5.20 M/cu mm | 12.0 - 15.0 g/dL | 36.0 - 46.0 % | 80.0 - 100.0 fL | 26.0 - 34.0 pg | 31.0 - 37.0 g/dL | 11.5 - 14.5 % | 150 - 350 K/cu mm | 9.2 - 12.7 fL | 0.00 - 0.01 K/cu mm | 40.0 - 70.0 % | 24.0 - 44.0 % | 2.0 - 11.0 % |
| 12/19/2016 | Yellow | Clear | 1.012 | 6 | Negative | Negative | Negative | Negative | Small (A) | Negative | Moderate (A) | <=1.0 | 0 | 1 | 1 | 3 | 0 | 0 | <1 | None | Rare | None | | | | | | | | | | | | | | |
| 1/24/2017 | | | | | | | | | | | | | | | | | | | | | | | 1.82 (L) | 4.71 | 12.6 | 39.3 | 83.4 | 26.8 | 32.1 | 13.1 | 165 | 12.5 | 0 | 42.4 | 37.9 | 16.5 (H) |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+------------------------+--------------+-------------------+-------------------------+-----------+-----------------------+---------------------------+-----------------------------+-------------------------------+----------------------------+----------------+---------------------------+---------------------+--------------------------+-----------------------+------------------------+---------------------+----------------------+-----------------------+-------------------------+-----------------+-----------------------+-----------------+------------------------+----------------------+------------------+---------------+-------------------------+-----------------+----------------------+------------------------+-------------------+----------------------+----------------------+---------------+---------------+--------------+
Sub RealignData()
Dim data As Variant
With Worksheets("Sheet1")
.UsedRange.TextToColumns Destination:=.Range("A1"), DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(79, 1), Array(128, 1), Array(154, 1)), TrailingMinusNumbers:=True
data = WorksheetFunction.Transpose(.UsedRange.Value)
.UsedRange.ClearContents
Range("A1").Resize(UBound(data), UBound(data, 2)).Value = data
End With
End Sub