Excel macro help

I want to export data from a listbox into excel app using xojo.

I want to put color in excel’s cell with specific criteria using IF function.

will it possible to do it with xojo excel plugin?

I have check on the web, excel macros vba can do this. But the problem is, I dont know how to execute/run an excel macro while exporting the data from listbox.

the vba code that I have found on the web

Dim myRng As Range

Set myRng = ActiveSheet.Range("A1: F33")

For Each Cell In myRng
If Cell.Value = "Price" Then Cell.Interior.ColorIndex = 35

If Cell.Value = "" Then Cell.Interior.ColorIndex = xlNone
Next Cell

any help?


if you want to change the color of a cell regarding its content, then you better use conditional formating for that.

Yes, this is worked too.
But, I want it run on a single click.

I have done it by using Mr. Eugene Dakin’s Excel sample code, how to run excel macro on startup. Its worked like a charm.