VBA中的这些代码是什么意思?求详解 5
Close#1Ifx=1ThenThisWorkbook.Sheets("原比对结果").Range("2:1000").DeleteThisWorkbook.Sheet...
Close #1
If x = 1 Then
ThisWorkbook.Sheets("原比对结果").Range("2:1000").Delete
ThisWorkbook.Sheets("分型结果").Range("2:4000").Delete
ThisWorkbook.Sheets("多序列排布结果").Range("2:4000").Delete
End If
arr = Split(txt, vbTab)
If UBound(arr) >= 16 Then
na = arr(1)
cr = ThisWorkbook.Sheets("原比对结果").Cells(Rows.Count, 1).End(xlUp).Row + 1
For a = 1 To 16
ThisWorkbook.Sheets("原比对结果").Cells(cr, 1) = "ref"
ThisWorkbook.Sheets("原比对结果").Cells(cr, a + 1) = arr(a)
Next
cr = ThisWorkbook.Sheets("分型结果").Cells(Rows.Count, 1).End(xlUp).Row + 1
ds = -1
iss = -1
If x = 1 Then
ReDim ref(1 To Len(arr(15)))
For l = 1 To UBound(ref)
ref(l) = VBA.Mid$(arr(15), l, 1)
Next
End If
If UBound(ref) < Len(arr(15)) Then
ReDim brr(1 To Len(arr(15)))
n = 0
For l = 1 To UBound(brr)
If VBA.Mid$(arr(15), l, 1) <> "-" Then
n = n + 1
brr(n) = VBA.Mid$(arr(16), l, 1)
If iss <> -1 Then
ThisWorkbook.Sheets("分型结果").Cells(cr, 1) = na
ThisWorkbook.Sheets("分型结果").Cells(cr, 2) = "Insertion"
ThisWorkbook.Sheets("分型结果").Cells(cr, 3) = iss - 1 & "/" & iss
ThisWorkbook.Sheets("分型结果").Cells(cr, 4) = "-->" & isst
iss = -1
isst = ""
cr = cr + 1
End If
Else
If iss <> -1 Then
isst = isst & VBA.Mid$(arr(16), l, 1)
Else
iss = l
isst = VBA.Mid$(arr(16), l, 1)
End If 展开
If x = 1 Then
ThisWorkbook.Sheets("原比对结果").Range("2:1000").Delete
ThisWorkbook.Sheets("分型结果").Range("2:4000").Delete
ThisWorkbook.Sheets("多序列排布结果").Range("2:4000").Delete
End If
arr = Split(txt, vbTab)
If UBound(arr) >= 16 Then
na = arr(1)
cr = ThisWorkbook.Sheets("原比对结果").Cells(Rows.Count, 1).End(xlUp).Row + 1
For a = 1 To 16
ThisWorkbook.Sheets("原比对结果").Cells(cr, 1) = "ref"
ThisWorkbook.Sheets("原比对结果").Cells(cr, a + 1) = arr(a)
Next
cr = ThisWorkbook.Sheets("分型结果").Cells(Rows.Count, 1).End(xlUp).Row + 1
ds = -1
iss = -1
If x = 1 Then
ReDim ref(1 To Len(arr(15)))
For l = 1 To UBound(ref)
ref(l) = VBA.Mid$(arr(15), l, 1)
Next
End If
If UBound(ref) < Len(arr(15)) Then
ReDim brr(1 To Len(arr(15)))
n = 0
For l = 1 To UBound(brr)
If VBA.Mid$(arr(15), l, 1) <> "-" Then
n = n + 1
brr(n) = VBA.Mid$(arr(16), l, 1)
If iss <> -1 Then
ThisWorkbook.Sheets("分型结果").Cells(cr, 1) = na
ThisWorkbook.Sheets("分型结果").Cells(cr, 2) = "Insertion"
ThisWorkbook.Sheets("分型结果").Cells(cr, 3) = iss - 1 & "/" & iss
ThisWorkbook.Sheets("分型结果").Cells(cr, 4) = "-->" & isst
iss = -1
isst = ""
cr = cr + 1
End If
Else
If iss <> -1 Then
isst = isst & VBA.Mid$(arr(16), l, 1)
Else
iss = l
isst = VBA.Mid$(arr(16), l, 1)
End If 展开
1个回答
展开全部
Close #1
'关闭文件
If x = 1 Then
'如果变量x的值等于1就执行下面的语句
ThisWorkbook.Sheets("原比对结果").Range("2:1000").Delete
'删除【原对比结果】表的2~1000行
ThisWorkbook.Sheets("分型结果").Range("2:4000").Delete
'类似上面
ThisWorkbook.Sheets("多序列排布结果").Range("2:4000").Delete
'类似上面
End If
'结束条件判断,前面的语句是否执行由前面的x值决定,此后的语句与此无关
每句都来打字解释可能真的没必要,哪句不懂的单独指出来吧,最好一次一两句
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询