How to convert the code from vba macro excel to


Cold you please tell how to change the code from vba macro to

Public Function CompareArrays(Array1 As Variant, Array2 As Variant, _
    ResultArray As Variant, Optional CompareMode As VbCompareMethod = vbTextCompare) As Boolean

End Function

iam not able to convert the code. iam getting error like

An error occured converting your code, probably due to a syntax error:
-- line 1 col 8: invalid NonModuleDeclaration
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
Use Linq and it could be like:

bool isEqual = array1.SequenceEqual(array2);

Gustav BrockCIOCommented:
Great! And you didn't even bother testing as that creates the error reported by the questioneer because this is VBA, not VB.NET.

mannevenu26Author Commented:
@Gustav Brock,

What you commented above it is not related my question.
When iam converting the code i got error that was mention above.please suggest if you have any idea.Please let me know.

Thanks you.

Hi friends,
this function should be convert from vab code to suggest if any body have idea.Please let me know.
Public Function CompareArrays
                       (Array1 As Variant,
                        Array2 As Variant,
                        ResultArray As Variant,
                        Optional CompareMode As VbCompareMethod = vbTextCompare
                        ) As Boolean
End Function

Thank you inadvance. :)
Gustav BrockCIOCommented:
My first comment is a method to compare two arrays which is what you ask for.

The second comment is related to a useless post now deleted.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.