VBA 隱藏存儲格

2009-02-13 6:36 pm
我有個excel file, 想將 A colum 同 B colum 的值 都等如零 就 hidden
請問應怎樣寫

回答 (2)

2009-02-14 7:06 am
✔ 最佳答案
Are u going to hidden the value '0' or the entire row

Calvin Lee

2009-02-13 23:06:40 補充:
try 2 methods:

1) Excel filter function
a) Ctrl + Home
b) Data > Filter > Auto filter
c) Select Custom in cell A1's arrow key
d) Select 'no equals to' and then input 0 for fitering
e) Repeat step c - d for cell b1

2) use vba
Sub hidRow()
Dim lRow As Long

Cells(1, 1).Select

For lRow = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If 0 = Cells(lRow, 1) And 0 = Cells(lRow, 2) Then
Cells(lRow, 1).Select
Selection.EntireRow.Hidden = True
End If
Next

End Sub

Calvin Lee, [email protected]
2009-02-14 3:01 am
Yes i am going to hidden the row when the cell value is zero in the same row of different column.
(e.g. cells(2,1) and cells(2,2) )


收錄日期: 2021-05-01 16:26:10
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090213000051KK00350

檢視 Wayback Machine 備份