Я изменил ваш код, чтобы гарантировать, что все переменные объявлены.
Sub HideRows()
'Ensure you declare all your variables
Dim ws1 As Worksheet, ws2 As Worksheet, lRow As Long
Dim ColumnOne As Integer, ColumnTwo As Integer
Dim dRng As Range, eRng As Range
Dim dRngCnt As Long, eRngCnt As Long
'Assign worksheets and variables
Set ws1 = ThisWorkbook.Sheets("Sheet1")
Set ws2 = ThisWorkbook.Sheets("Sheet2")
'Identifying the specific range as variable
Set dRng = ws2.Range("D2:D9")
Set eRng = ws2.Range("E2:E9")
'Assigning a variable to the countA will simplify your IF and ELSEIF statements
dRngCnt = Application.WorksheetFunction.CountA(dRng)
eRngCnt = Application.WorksheetFunction.CountA(eRng)
With ws1
ColumnOne = .Cells(1, .Columns.Count).End(xlToLeft).Column
'I replaced "lastColumn" with "ColumnOne", because they are the same value, so you only need to use one
lRow = .Cells(.Rows.Count, ColumnOne).End(xlUp).Row
ColumnTwo = ColumnOne - 1
If dRngCnt <> 0 Then 'I use the countA variable for column D Range
For i = 1 To lRow
If .Cells(i, ColumnTwo).Value = 0 Then 'Any 0s in the second to last columns will hide the row
.Rows(i).EntireRow.Hidden = True
End If
Next i
ElseIf eRngCnt <> 0 Then 'I use the countA variable for column E Range
For i = 1 To lRow
If .Cells(i, ColumnOne).Value = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
Else
Exit Sub
End If
End With
End Sub
command-shift-D (Xcode 4: command-shift-O) opens a Quick Open window where you can type a partial class name and hit enter to open the file. As far as more complex versions such as what Eclipse offers (method names, symbol names, etc), I don't believe anything like that is built into XCode.
Если вы нажмете Ctrl на имени класса, имени метода или имени функции, вы увидите длинное меню, в котором вы можете найти элемент Перейти к определению .
In addition to the Quick Open window, there is the class browser. The class browser allows you to view the class hierarchy. The Class Browser can be found under the Project menu.
Элемент «Перейти к определению» доступен через CMD + двойной щелчок, который приведет вас прямо к соответствующему коду
. Кроме того, вы можете «Перейти к документации» с помощью (Option или ALT ) + двойной щелчок по классу / методу / свойству
Обновление: Option + двойной щелчок больше не приводит вас непосредственно к документации в Snow Leopard. Теперь открывается небольшой «пузырек» документации, с возможностью перехода в браузер документации, если это необходимо.
Также: выберите идентификатор, щелкните его правой кнопкой мыши и выберите «Найти в проекте»> «Как символ» (или «Найти в проекте» и выберите «Символ в качестве типа поиска»). Отображаются все использования символов, т. Е. , объявления, определения и сайты для звонков.