您好我想创建代码,我可以在其中复制某个数组中的值,并仅将该数组的值粘贴到前面的列中。 要复制的数组是多个数组,应该复制并粘贴到前面的列中,但前提是A列中有数值。
以下是将它们粘贴在前面的列中(覆盖其余部分)的结果:
我的代码无法正常工作,主要是我认为我的循环存在问题。第一个循环应指示副本仅发生在A列中的值为数字的行上。
Sub Cop()
Application.ScreenUpdating = False
Set CopySheet = ThisWorkbook.Sheets("Sheet1")
Const ColStart As Integer = 4 'Table to start copying
Const NewColStart As Integer = 3 'Table to start pasting
Const ColEnd As Integer = 10 'Table ends for copying and pasting
Const ColumnNumeric As Integer = 1 'Column with numbers
Dim TargetRow As Long
Dim i As Long
Dim cell1 As Range
Dim cell2 As Range
TargetRow = 4 'Row where my table an column with numbers starts
With CopySheet
For Each cell1 In Range(.Cells(TargetRow, ColumnNumeric), .Cells(.Rows.Count, ColumnNumeric))
If IsNumeric(cell1) = True Then
'Numeric value found.
For Each cell2 In Range(.Cells(TargetRow,ColStart),.Cells(.Rows.Count, ColEnd))
cell2.Copy
.Range(.Cells(TargetRow, NewColStart), .Cells(.Rows.Count, ColEnd)).PasteSpecial (xlPasteValuesAndNumberFormats)
Application.CutCopyMode = False
Next cell2
TargetRow = TargetRow + 1
Else
Exit Sub
End If
Next cell1
TargetRow = TargetRow + 1
End With
有人可以帮忙吗?我正在尝试不同的循环,但我不知道如何完成它们。
答案 0 :(得分:1)
此子项目
ifstream fin;
string reader;
while(fin>>reader)
{
if(reader == "v"){
vec3 vertex;
fin>>vertex.x>>vertex.y>>vertex.z;
out_vertices.push_back(vertex);
} else if(reader == "vn"){
vec3 normal;
fin>>normal.x>>normal.y>>normal.z;
out_normals.push_back(normal);
}else if(reader== "f"){
vec2 facet;
vec3 _normal,_vertex;
fin>>_vertex.x>>_vertex.y>>_vertex.z >>_normal.x>>_normal.y>>_normal.z;
facet.normal = _normal;
facet.vetex = _vertex;
out_facets.push_back(facet);
}
}
)COL_NUMERIC
开始)复制到数组COL_START
>> 1)COL_START