Я намагаюся додати деякі підсвічування, засноване на значенні в стовпці та зберегти файл як .xlsx ... Я, здається, не зможуть правильно визначити синтаксис. Дякую :)
" Highlight classifications
For iRow = 2 To rData.Rows.Count "Start at line #2 to ignore the header row
Set rw = rData.Rows(iRow)
If rw.Cells(iRow, iClassification).Value = "VUS" Then
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 6 "Yellow
ElseIf rw.Cells(iRow, iClassification).Value = "not provided" Then _
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 21 "Purple
ElseIf rw.Cells(iRow, iClassification).Value = "likely pathogenic" Then _
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 9 " Dark Red
End If
Next iRow
End If
" Create new workbooks based on name
Dim sSave As String
Dim sFN As String
Dim Directory As String
Beep
sSave = MsgBox("The data has been formatted and classified. Do you want to save the workbook now?", vbQuestion + vbYesNo)
If sSave = vbYes Then
Matrix "Call the matrix routine
sFN = [A1] & "_hg19annovar.xlsx"
Directory = "N:TorrentSetupClinical"
ActiveWorkbook.SaveAs Filename:=Directory & sFN, FileFormat:=51
Application.DisplayAlerts = True
Application.Quit
If sFN = "False" Then Exit Sub
Else
MsgBox "This workbook has not yet been saved!", vbExclamation
End If
End Sub
Відповіді:
0 для відповіді № 1Це трохи, що дає помилки?
If rw.Cells(iRow, iClassification).Value = "VUS" Then
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 6 "Yellow
If rw.Cells(iRow, iClassification).Value = "not provided" Then _
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 21 "Purple
If rw.Cells(iRow, iClassification).Value = "likely pathogenic" Then _
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 9 " Dark Red
End If
Вона повинна бути:
If rw.Cells(iRow, iClassification).Value = "VUS" Then
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 6 "Yellow
ElseIf rw.Cells(iRow, iClassification).Value = "not provided" Then _
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 21 "Purple
ElseIf rw.Cells(iRow, iClassification).Value = "likely pathogenic" Then _
rw.Cells(iRow, iClassification).EntireRow.Interior.ColorIndex = 9 " Dark Red
End If