I have a workbook that has 84 sheets in it. In each sheet there are 2 columns. First column is application name and second column is its version.
I wrote a macro to get list of applications which is my first time writing. It works fine but its painfully slow. I never have worked with VBA before so I might did something wrong.
What I tried to accomplish is to get a summary report of installed apps. It searches the Application Report sheet for every row in each sheet. If it isn't in the list, it adds a new row and then puts 1 as its count. If the application is in the list, it adds up 1 to its count.
Sub CombineAllPrograms()
Dim ws As Worksheet
Dim Rapor As Worksheet
Dim xApp As String
Dim xi As Integer
Dim xRi As Integer
Dim xLast As Integer
Dim xRange As range
Set Rapor = Sheets("Application Report")
xRi = 1
Application.ScreenUpdating = False
For Each ws In Sheets
If ws.Name = "Application Report" Then GoTo ContinueLoop
For xi = 3 To 30
If ws.Cells(xi, "I") = vbNullString Then Exit For
xApp = ws.Cells(xi, "I").Value & " " & ws.Cells(xi, "J").Value
With Rapor.range("A:A")
Set xRange = .Find(xApp, LookAt:=xlWhole, SearchOrder:=xlByRows)
If xRange Is Nothing Then
Rapor.Cells(xRi, "A").Value = xApp
Rapor.Cells(xRi, "B").Value = ws.Cells(xi, "I").Value
Rapor.Cells(xRi, "C").Value = ws.Cells(xi, "J").Value
Rapor.Cells(xRi, "D").Value = 1
xRi = xRi + 1
Else
Rapor.Cells(xRange.Row, "D").Value = Rapor.Cells(xRange.Row, "D").Value + 1
End If
End With
Next xi
ContinueLoop:
Next
Application.ScreenUpdating = True
End Sub
What can I do to make it faster? Maybe I chosee a slow method and there is a better way?