Results 1 to 6 of 6

Loop stuck in exit sub

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-24-2004
    MS-Off Ver
    Excel 2013 Pro Plus
    Posts
    122

    Loop stuck in exit sub

    Hello friends, Hope all is well!

    I am having difficulty with looped code here.

    I want the loop to run on range R10 and so on.
    if the cells = "", then exit sub if cell does not "" then proceed,
    The problem I am having is that the code is not moving to the next cell

    please help me, and thanks a lot in advance!


    Sub PRINTER()
     
          Dim x As Integer, cell As Range
          
          Sheets("pt").Select
          
       '   Application.ScreenUpdating = False
          ' Set numrows = number of rows of data.
          NumRows = Sheets("pt").Range("bR10", Range("bR10").End(xlDown)).Rows.Count
          ' Select cell a1.
          Set cell = Sheets("pt").Range("bR10")
          ' Establish "For" loop to loop "numrows" number of times.
          For x = 1 To NumRows
             ' Insert your code here.
             cell.Select
             
             If cell.Value = "" Then
             Exit Sub
             
             Else
                'cell.Select  'This line is not needed, but is put here in case you need to track visually where is current progress
               
             cell.Copy
             Range("BX10").PasteSpecial xlPasteValues
          
             Call Print_Format
                
                End If
             ' Selects cell down 1 row from active cell.
             Set cell = cell.Offset(1, 0)
          Next
          Application.ScreenUpdating = True
          
        Columns("A:AV").Select
        Selection.EntireColumn.Hidden = False
        ActiveSheet.PageSetup.PrintArea = "$A:$AV"
        Range("A1").Select
          
    End Sub
    Attached Files Attached Files
    Last edited by countryfan_nt; 03-12-2017 at 07:30 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Stuck in For Each Loop
    By Bob1980 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2012, 06:08 PM
  2. [SOLVED] Do - Loop Until loop with randbetween gets stuck
    By supern0va in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-31-2012, 06:06 AM
  3. Stuck on a Loop
    By adamcross in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-02-2012, 07:50 AM
  4. Stuck in a loop
    By dem86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2011, 01:20 PM
  5. Stuck in a loop
    By cdmg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2010, 03:19 AM
  6. stuck in a Do Loop?
    By keatonlg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2009, 12:35 AM
  7. Stuck in a loop
    By CWillis in forum Excel General
    Replies: 2
    Last Post: 06-05-2006, 09:55 AM
  8. HELP - Stuck in loop
    By gti_jobert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2006, 08:41 AM

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