Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi everybody I have named some cells in a worksheet in the following way: Skjul1, Skjul2, Skjul3... Skjul69, Skjul70. Now I would like to make a vba script that locates each cell and checks the value of the cell. If the value = 0, the entire row should be hidden. I thought that I could make a loop like the following: Private Sub Skjul() Dim i As Long i = 0 Do Until i = 75 If Sheets("spec").Range("Skjul" & i).Value = "0" Then Sheets("spec").Range("Skjul" & i).EntireRow.Hidden = True Else Sheets("spec").Range("Skjul" & i).EntireRow.Hidden = False End If On Error GoTo 0 i = i + 1 Loop Until i = 75 End Sub ... but it doesn't work! I get the error: "Run-time error '1004': Application-defined or object-defined error". Can anyone help me? I would really appreciate the effort! -- Thomas Olesen ------------------------------------------------------------------------ Thomas Olesen's Profile: http://www.excelforum.com/member.php...o&userid=28025 View this thread: http://www.excelforum.com/showthread...hreadid=475313 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using INDEX() to Locate Variable Data | Excel Discussion (Misc queries) | |||
Looping and String Variable | Excel Programming | |||
Looping to create Variable Names? | Excel Programming | |||
Increment a variable while looping | Excel Programming | |||
locate max value in variable range | Excel Programming |