![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 45
|
Can some one help me write a Macro to hide a row if the value in a cell of that row is >95?
The sooner the better! Thanks! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
This worked for me:
---begin VBA--- Sub test() Dim rng As Range, usedcell As Range Set rng = ActiveSheet.UsedRange For Each usedcell In rng If usedcell.Value > 95 Then _ usedcell.EntireRow.Hidden = True Next usedcell End Sub ---end VBA-- Bye, Jay |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 45
|
How do I refer to the cell?
Say the column with the value is d? |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
----------- Sub test() Dim rng As Range, usedcell As Range Set rng = Intersect(ActiveSheet.UsedRange, ActiveSheet.Range("D:D")) For Each usedcell In rng If usedcell.Value > 95 Then _ usedcell.EntireRow.Hidden = True Next usedcell End Sub --------------- Bye, Jay |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|