ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Defining a range and use it's value (https://www.excelbanter.com/excel-programming/348210-defining-range-use-its-value.html)

Petitboeuf[_3_]

Defining a range and use it's value
 

:confused:

i use the following code:


Code:
--------------------
Sub CleanSheetHideRows()
Dim nCol As Integer
Dim J As Integer
Dim i As Integer

Application.ScreenUpdating = False
With ActiveSheet
.Range("B4").Select
nCol = 2
For J = 4 To 6000
If .Cells(J, nCol).Value = 0 Then
.Cells(J, nCol).Select
Selection.EntireRow.Hidden = True
End If
Next J
For i = 4 To 6000
If .Cells(i, nCol).Value = "ALL WEEKS" Then
.Cells(i, nCol).Select
Selection.EntireRow.Font.Bold = True
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
--------------------


But i need toahev the RANGE of that row not just one column to be
looked at for 0 value...

Any suggestions please? :)


--
Petitboeuf
------------------------------------------------------------------------
Petitboeuf's Profile: http://www.excelforum.com/member.php...o&userid=10602
View this thread: http://www.excelforum.com/showthread...hreadid=493817


Dave Peterson

Defining a range and use it's value
 
Depends on what this means:

But i need toahev the RANGE of that row not just one column to be
looked at for 0 value...

Do you mean that any cell in that row can be 0 and the row should be hidden?

if application.countif(.rows(j),0)0 then
.rows(j).hidden = true
end if

if you mean that the sum of all that row must be 0:

if application.sum(.rows(j)) = 0 then
...



Petitboeuf wrote:

:confused:

i use the following code:

Code:
--------------------
Sub CleanSheetHideRows()
Dim nCol As Integer
Dim J As Integer
Dim i As Integer

Application.ScreenUpdating = False
With ActiveSheet
.Range("B4").Select
nCol = 2
For J = 4 To 6000
If .Cells(J, nCol).Value = 0 Then
.Cells(J, nCol).Select
Selection.EntireRow.Hidden = True
End If
Next J
For i = 4 To 6000
If .Cells(i, nCol).Value = "ALL WEEKS" Then
.Cells(i, nCol).Select
Selection.EntireRow.Font.Bold = True
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
--------------------

But i need toahev the RANGE of that row not just one column to be
looked at for 0 value...

Any suggestions please? :)

--
Petitboeuf
------------------------------------------------------------------------
Petitboeuf's Profile: http://www.excelforum.com/member.php...o&userid=10602
View this thread: http://www.excelforum.com/showthread...hreadid=493817


--

Dave Peterson


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com