Home Invalid Outside Procedure error with VBA
Reply: 0

Invalid Outside Procedure error with VBA

user1394
1#
user1394 Published in April 25, 2018, 12:18 pm

I am trying to combine several cells of data with the same label. There will either be 2 or 3 (also accounted for 1) repeated cells. I keep getting an invalid outside procedure error function. It highlights the "module module1" so I think it is something to do with defining my class, but I am not familar enough with VBA to figure it out.

Module Module1
Public Sub Main()
    Dim num As Integer
    num = 2
    Dim val As Integer
    val = 2
    While num <= 5031
        If StrComp(Cells(num, 3).Value, Cells((num + 1), 3).Value, vbTextCompare) = 0 And StrComp(Cells(num, 3).Value, Cells((num + 1), 3).Value, vbTextCompare) = 0 Then
            Cells(val, 5) = Calls(num, 3).Value
            Cells(val, 6) = Add(Cells(num, 4).Value, Cells(num + 1, 4).Value, Cells(num + 2, 4).Value)
            num = num + 3
            val = val + 1
            End If
        ElseIf StrComp(Cells(num, 3).Value, Cells((num + 1), 3).Value, vbTextCompare) = 0 Then
            Cells(val, 5) = Calls(num, 3).Value
            Cells(val, 6) = Add(Cells(num, 4).Value, Cells(num + 1, 4).Value)
            num = num + 2
            val = val + 1
            End If
        Else
            Cells(val, 5) = Calls(num, 3).Value
            Cells(val, 6) = Cells(num, 4).Value
            num = num + 1
            val = val + 1
            End If

    Wend
End Sub
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.659795 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO