How to fix cell format because excel cell loses format after running macro

Hi, I am filling out the data on an excel sheet using the DDE.Execute command from Oracle forms. The code is fine, but when I execute the FORMAT_SECTION_TITLE_2 macro below using the DDE.Execute command, it colors the string and also changes the date to a number and, rather, the value of the cell that appears as the correct date, it displays as 39234

Sub FORMAT_SECTION_TITLE_2()

    With Selection.Interior
        .ColorIndex = 7
        .Pattern = xlSolid
    End With
    Selection.Font.Bold = False
End Sub

I also tried to change a lot of things, but did not help. please suggest.

thank

Update 1: Siddhart, I added a new sub in the excel sheet, as you mentioned, and my sheet name is the same as your mentioned Sheet1

Sub formatColumn()
Sheets("Sheet1").Columns(1).NumberFormat = "dd-mmm-yy"
End Sub
+3
source share
1 answer

Shax, , , XY:)

, .

Sub two_decimals()
    Selection.NumberFormat = "#,##0.00"
End Sub

, two_decimals FORMAT_SECTION_TITLE_2 oracle, .

: , !

+2

All Articles