EXCEL VBA using FOR LOOP that will disregard the step +1 LOOP COUNTER -


i in search of solution disregard or take 1 step loop counter. here code better understanding.

 sub downarrow5_click() dim c integer dim copyfromrow integer  copyfromrow = 1  c = 1 20    if activesheet.rows(copyfromrow).hidden = false , range("a" & c & "").value <> ""    'start copy paste     activesheet.range("a" & copyfromrow & ", c" & copyfromrow & "").copy     sheets("sheet2").select     activesheet.range("a1").select     activecell.offset(1, 0).select     activesheet.paste     activecell.offset(1, 0).select     sheets("sheet1").select     application.cutcopymode = false      else         c = 'disregard +1 loop     end if  next c    end sub 

i can't decrement counter since have negative (-) result returning unending loop.

note: need copy , paste 20 unhidden rows sheet2. why need max counter (20). brief code working on.

use type of loop:

c = 1     if (condition)         'do stuff           c = c+1  'increment counter variable     else:         'presumably nothing, i.e., "disregard" loop.         ' not increment counter variable in else block     end if  loop while not c > 20 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -