Python Forum
Vba conversion to Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Vba conversion to Python (/thread-14503.html)



Vba conversion to Python - stranger14u - Dec-03-2018

Hi
gentlemen is there a way to convert a VBA code to python, the code below as an example will be appreciated
Sub LotFilter()
Dim RngDelete As Range
Application.ScreenUpdating = False
For Each rw In Range("H1:M3").Rows
  ReDim matches(1 To 1)
  For Each rowe In Range("A2:F12").Rows
    x = Evaluate("SUMPRODUCT(COUNTIF(" & rw.Address & "," & rowe.Address & "))")
    If x > 3 Then
      If RngDelete Is Nothing Then
        Set RngDelete = rowe
      Else
        Set RngDelete = Union(RngDelete, rowe)
      End If
    End If
  Next rowe
Next rw
If Not RngDelete Is Nothing Then
 ' RngDelete.Select  'or one of the 2 lines below:
 'RngDelete.Delete Shift:=xlUp
 RngDelete.EntireRow.Delete
End If
Application.ScreenUpdating = True
End Sub
Regards


RE: Vba conversion to Python - heiner55 - May-26-2019

See http://vb2py.sourceforge.net/