P
Petitboeuf
Hi all
I am fearly useless when it comes to coding in VB as the code belo
will prove
Before I give the code I thought I'd share the 'what' I want t
achieve.
I am dumping huge amount of data into excel from an external databas
and then want to clean the shpreadsheet removing all the irrelevan
clutter. By that i mean that I want to hide the rows that contain dat
where I have 0 as a result.
But i want it as a range result. ie I select B5 to B26, check the tota
in =SUM and if it is equal to 0 I want to hide it. Pretty simple uh

Here is what I tried... and it dosen't work
*Sub SortSheet()*
Dim i As Integer
Dim R As Range
With ActiveSheet
Set R = Range("B6:AB6")
For i = 6 To 6000
If R.Value = 0 Then
R.Select
Selection.EntireRow.Hidden = True
End If
Next R
End With
End Sub
I then tried something else thinking the range was to set...
*Sub SortSheet()*
Dim nRange As Integer
Dim R As Range
With ActiveSheet
For nRange = .Range(.Cells(5, 2), .Cells(5, 28)) To _
.Range(.Cells(6000, 2), .Cells(6000
28))
If R.Value = 0 Then
R.Select
Selection.EntireRow.Hidden = True
End If
Next nRange
End With
End Sub
That didn't work either...
Please help! I'm lost!!!!!
Many thanks
I am fearly useless when it comes to coding in VB as the code belo
will prove

Before I give the code I thought I'd share the 'what' I want t
achieve.
I am dumping huge amount of data into excel from an external databas
and then want to clean the shpreadsheet removing all the irrelevan
clutter. By that i mean that I want to hide the rows that contain dat
where I have 0 as a result.
But i want it as a range result. ie I select B5 to B26, check the tota
in =SUM and if it is equal to 0 I want to hide it. Pretty simple uh

Here is what I tried... and it dosen't work

*Sub SortSheet()*
Dim i As Integer
Dim R As Range
With ActiveSheet
Set R = Range("B6:AB6")
For i = 6 To 6000
If R.Value = 0 Then
R.Select
Selection.EntireRow.Hidden = True
End If
Next R
End With
End Sub
I then tried something else thinking the range was to set...
*Sub SortSheet()*
Dim nRange As Integer
Dim R As Range
With ActiveSheet
For nRange = .Range(.Cells(5, 2), .Cells(5, 28)) To _
.Range(.Cells(6000, 2), .Cells(6000
28))
If R.Value = 0 Then
R.Select
Selection.EntireRow.Hidden = True
End If
Next nRange
End With
End Sub
That didn't work either...
Please help! I'm lost!!!!!

Many thanks