I have been working on vb for past few days..Its really interesting.But I wanna know how can we convert VB.net code to vba. A code which I wanna convert to VBA and run it as a macro. Please any help would be appreciative.
Printable View
I have been working on vb for past few days..Its really interesting.But I wanna know how can we convert VB.net code to vba. A code which I wanna convert to VBA and run it as a macro. Please any help would be appreciative.
VB.NET provides far more functionality than VBA. Some code might be able to be translated as is, some might need a bit of tweaking and some might be all but impossible to replicate. It all depends on the specifics of the code.
Thanks..code is something like the below.
Code:Dim col As Integer = DGV.Columns.Count
If col > 1 Then
Dim start As Date = Date.Today.Add(New TimeSpan(0, 15, 0))
Dim end As Date = Date.Today.Add(New TimeSpan(11, 15, 0))
Dim cellV As String, cellD As Date
For i As Integer = 1 To col - 1
For Each row As DataGridViewRow In DGV.Rows
cellV = row.Cells(i).Value.ToString
If Date.TryParse(cellV, cellD) Then
If cellD > start AndAlso cellD < end Then
row.Cells(i).Style.BackColor = Color.brown
End If
End If
Next
Next
End If