+ Reply to Thread
Results 1 to 3 of 3

Problems with IF and DO WHILE LOOP

  1. #1
    Registered User
    Join Date
    03-05-2015
    Location
    Munich, Bavaria
    MS-Off Ver
    2010
    Posts
    2

    Question Problems with IF and DO WHILE LOOP

    Hi there,

    please bear with me, i'm a novice

    My Problem:

    I need a Macro that can unhide and hide a row depending on the input of a cell.

    The Macro has to start automatically if you open the document.

    It has to loop nonstop

    If in My Example the Cell P7 = 1 the macro should unhide row 10
    If the Cell P7 = 0 the macro should hide row 10

    Here You can See My Try on the Problem
    It sadly doesn't work


    Sub Auto_Open()

    Call Row

    End Sub

    Sub Row()

    Do While I3 = 1


    If P5 = 1 Then

    Call Row_unhide

    Else

    Call Row_hide

    Exit Do


    End If

    Loop

    End Sub

    Sub Row_unhide()

    Rows("9:11").Select
    Selection.EntireRow.Hidden = False

    End Sub

    Sub Row_hide()

    Rows("10").Select
    Selection.EntireRow.Hidden = True

    End Sub



    Hope you guys can help me :D
    -Ymgarl

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Problems with IF and DO WHILE LOOP

    It has to loop nonstop
    Why do you think it has to do this?

  3. #3
    Registered User
    Join Date
    03-05-2015
    Location
    Munich, Bavaria
    MS-Off Ver
    2010
    Posts
    2

    Re: Problems with IF and DO WHILE LOOP

    Because i use this macro in a snake and ladder game and if i am in a special area around 50 i have to unhide a row. in this row there are a few buttons which can only be used if u are in this area

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problems with a For Each loop
    By lordterrin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-27-2013, 02:10 PM
  2. Problems using IF statement in DO WHILE loop
    By walneyhammer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2009, 12:10 PM
  3. Loop Problems
    By wesbuckley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2009, 06:38 AM
  4. [SOLVED] problems with loop
    By Arjan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2005, 05:20 AM
  5. So close! Problems with Loop
    By Linking to specific cells in p in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2005, 02:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1