close

Hi,

I want to set up a looping macro in VBA so that it looks at the first
column of the work book and if this is empty, the entire row is
hidden.

I have got the code below - the lopping works just cant get the correct
code for hidding the row.

SUB PRINTPAGE()

DIM MAIN AS WORKSHEET
DIM MROW AS LONG
SET MAIN = THISWORKBOOK.WORKSHEETS(\quot;WORKPLANNER\quot;)
MROW = 8

DO UNTIL MROW = 352

IF MAIN.CELLS(MROW, 1) = \quot;\quot; THEN
-MAIN.CELLS(MROW, \quot;\quot;) = \quot;TEST\quot;-ELSE
END IF
MROW = MROW 1
LOOP
END SUB

also when i print a worksheet with a number of hidden rows is there a
way for Excel to ignore these completely.Thanks

Steven--
sarcher
------------------------------------------------------------------------
sarcher's Profile: www.excelforum.com/member.php...oamp;userid=34457
View this thread: www.excelforum.com/showthread...hreadid=542123Sub PRINTPAGE()

Dim MAIN As Worksheet
Dim MROW As Long
Set MAIN = ThisWorkbook.Worksheets(quot;WORKPLANNERquot;)

For MROW = 8 To 352
If MAIN.Cells(MROW, 1).Value = quot;\quot; Then
MAIN.Rows(MROW).Hidden = True
End If
Next MROW

End Sub

HTH
--
AP

quot;sarcherquot; gt; a écrit
dans le message de news:
...
gt;
gt; Hi,
gt;
gt; I want to set up a looping macro in VBA so that it looks at the first
gt; column of the work book and if this is empty, the entire row is
gt; hidden.
gt;
gt; I have got the code below - the lopping works just cant get the correct
gt; code for hidding the row.
gt;
gt; SUB PRINTPAGE()
gt;
gt; DIM MAIN AS WORKSHEET
gt; DIM MROW AS LONG
gt; SET MAIN = THISWORKBOOK.WORKSHEETS(\quot;WORKPLANNER\quot;)
gt; MROW = 8
gt;
gt; DO UNTIL MROW = 352
gt;
gt; IF MAIN.CELLS(MROW, 1) = \quot;\quot; THEN
gt; -MAIN.CELLS(MROW, \quot;\quot;) = \quot;TEST\quot;-ELSE
gt; END IF
gt; MROW = MROW 1
gt; LOOP
gt; END SUB
gt;
gt; also when i print a worksheet with a number of hidden rows is there a
gt; way for Excel to ignore these completely.
gt;
gt;
gt; Thanks
gt;
gt; Steven
gt;
gt;
gt; --
gt; sarcher
gt; ------------------------------------------------------------------------
gt; sarcher's Profile:
gt; www.excelforum.com/member.php...oamp;userid=34457
gt; View this thread: www.excelforum.com/showthread...hreadid=542123
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()