我使用以下vba脚本隐藏Active Cell行A列中匹配单元格值的所有行:
If Not Intersect(ActiveCell, Range("I:I")) Is Nothing And ActiveCell.Value = "-" Then
BeginRow = 1
EndRow = 50000
ChkCol = 1
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = ActiveCell.Offset(1, -8) Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
End If
因此,例如,如果我有5行,所有在A列中的数字为35,如下所示:
A I
35 Click to hide <----- First Row
35
35
35
35
然后将隐藏所有这些行。但是,我不希望隐藏第一个实例的行。
答案 0 :(得分:0)
添加两个变量(一个变量用于保存要比较的值,一个布尔值用于验证找到的第一个值)
If Not Intersect(ActiveCell, Range("I:I")) Is Nothing And ActiveCell.Value = "-" Then
BeginRow = 1
EndRow = 50000
ChkCol = 1
bl1stVal = False
vCllValue = ActiveCell.Offset(1, -8).Value
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = vCllValue Then
If Not (bl1stVal) Then
bl1stVal = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If: End If: Next: End If
这是修订后的代码:
ActiveCell
注意到代码会比较<form action="confirm_form.php" role="form" method="POST">
<div class="form-group">
<label for="carrier">Select Carrier</label>
<select class="form-control" id="carrier" name="carrier">
<?php
$q = "SELECT * FROM carriers";
$carriers = mysqli_query($con, $q);
while($row = mysqli_fetch_assoc($carriers)){
$carrier_id = $row['car_id'];
$carrier_name = $row['car_name'];
echo "<option value='$carrier_id'>$carrier_name</option>";
}
?>
</select>
</div>
<button type="submit" value="submit" name="submit">Add customer</button>
</form>
I&#39; m下方行中的值,假设该部分是正确的,否则请告知我并进行必要的调整。 < / p>