How to select column and display its current format using VBA Macro?
<p><br/></p>

<p>Please find my requirement below for which I am unable to find any solution:<br/></p>

<p><i>1. Iterate over workSheet from workbook<br/>
2. Find all the columns containing date values using current format/type of column <br/><strong>(Here is a trick. Worksheet is not static, it can contain any number of columns containing date values. Columns containing date values may have any name. And such worksheets can be more than one in number)</strong><br/>
3. Apply macro on date columns for date formatting (below macro) if "Flag" value is "y"</i><br/></p>

<pre><code>&lt;code&gt;
Sub FormatDate()
    If wksSecDist.Range("Flag").value = "y" Then
        LastRowColA = Range("X" &amp; Rows.Count).End(xlUp).Row
        ' Here I am finding total number of rows in column X
        wksSecDist.Range("X2", "X" &amp; LastRowColA).NumberFormat = "dd/mmm/yyyy"
        ' Here applying specified date format to Range("X2", "X10") [if last row index for column X is 10]
    End If
End Sub
&lt;/code&gt;
</code></pre>

<p><br/>
I am just a beginner to VBA.<br/>
Thanks in advance.</p>