'EXCEL VBA: loop through each column to change the data format

Because I can only change the data format for only one column I need a loop which counts from column "E:E" to column "GN:GN" to change the format for each column.

I tried it like this:

Sub Format()

Dim intCol As Long

For intCol = 5 To 196 ' this would be E to GN??

Columns("intCol").Select
    Selection.TextToColumns Destination:=Range("intCol""1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 1), TrailingMinusNumbers:=True
    Selection.NumberFormat = "0.00"
    
  
Next intCol

End Sub

i need to go over data format, because i have this format right now (it doesnt change with "normal" NumberFormat): enter image description here

It would be so nice, if someone could help me out!



Solution 1:[1]

What are you talking about?

Hereby a screenshot (I've hidden most columns for readability):

enter image description here

In VBA:

Range("E1:GN1048576").NumberFormat = "0.00"

Or, as I find readability important:

Columns("C:GN").NumberFormat = "0.00"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dominique