Hi I have code in VBA i want to convert it to VB.NET
the code

  Dim lastrow As Integer
    Dim curRow As Integer
    Dim newrow As Integer
    lastrow = exWS2.Cells.Rows.End(XlDirection.xlDown).Row
    exWS2.Cells(8, 6).Value = "Max"
    exWS2.Cells(8, 7).Value = "=Max(B2:B" & lastrow & ")"
    newrow = 8
    For curRow = 2 To lastrow
        If exWS2.Cells(curRow, 2) = exWS2.Cells(8, 7).Value Then
            newrow = newrow + 1
            exWS2.Cells(newrow, 6).Value = exWS2.Cells(curRow, 1).Value
        End If
    Next curRow

Recommended Answers

All 7 Replies

Congratulations! You're no longer a DaniWeb newbie.<br /> <br />
Your DaniWeb account has just been upgraded from newbie status and now you have the ability to take advantage of everything the community has to offer.<br /> <br />
You can now enjoy an advertisement-free DaniWeb by ticking the checkbox to Disable Ads in your profile. You will no longer have to fill out the human verification check when you post. You can also now send unlimited private messages, participate in live chat, opt-in to mailing list-style notifications which allows you to read and contribute posts via email, contribute new code snippets, contribute editorial, access Area 51 and tag articles with never-before-used tags.

Congratulations! You're no longer a DaniWeb newbie.<br /> <br />

Why do people feel the need to post the contents of this notification? I'm genuinely curious.

without causes

Do you need to have access to excel from VB.NET or is it just a translation you want?

i want to translate the code to vb.net to be useful to access excel from vb.net

thanks and translation of the code please :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.