title: variable i=i +1 for visible cells
body: <p>I would like to ask. I have a code that works perfectly. The problem comes when the user filters the data in Excel. Some rows will be hidden. Then the variable i = i + 1 does not work. (Works but runs through all lines)
  Basically, I'm asking how can I set a variable for visible rows only?
  Thank you for help!</p>
  <pre><code>i = 2
  Do
   'If Sheets(&quot;FORMAT&quot;).Cells(i, 7) Like &quot;*IE-12-2007984*&quot; Then
    'End If
    On Error GoTo Handler
  session.findById(&quot;wnd[0]&quot;).maximize
  session.findById(&quot;wnd[0]/usr/ctxtI_VBUKR&quot;).Text = &quot;1200&quot;
  session.findById(&quot;wnd[0]/usr/ctxtI_PSPID-LOW&quot;).Text = Sheets(&quot;Stavby&quot;).Cells(i, 7)
  session.findById(&quot;wnd[0]/usr/ctxtP_VARI&quot;).Text = &quot;AKTUALIZACE&quot;
  session.findById(&quot;wnd[0]/tbar[1]/btn[8]&quot;).press
  Set myGrid = session.findById(&quot;wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell&quot;)
  Sheets(&quot;Stavby&quot;).Cells(i, 2).Value = myGrid.getcellvalue(0, &quot;TXT04&quot;)
  session.findById(&quot;wnd[0]/tbar[0]/btn[3]&quot;).press
  Handler2:
  session.findById(&quot;wnd[0]/usr/ctxtI_PSPID-LOW&quot;).Text = Sheets(&quot;Stavby&quot;).Cells(i, 7)
  
  i = i + 1
  If Sheets(&quot;Stavby&quot;).Cells(i, 7).Value = &quot;&quot; Then Exit Do
  Loop
  If Sheets(&quot;Stavby&quot;).Cells(i, 7).Value = &quot;&quot; Then
  
  Set session = Nothing
  Connection.CloseSession (&quot;ses[0]&quot;)
  Set Connection = Nothing
  Set SAP = Nothing
  MsgBox &quot;HOTOVO&quot;
  Exit Sub
  Handler:
   Resume Handler2
   End If
  End Sub```
  </code></pre>