Alana O
Alana O

Reputation: 7

Simplifying code into one line in excel vba?

Here is my code:

Sub part1()
    Range("A1", Range("A1").End(xlDown)).Select
    Selection.NumberFormat = "0"
End Sub

I want to simplify it into 1 line so that it formats column A as integers. I know it's a very simple question but please help me.

Upvotes: 0

Views: 131

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

Sub part1()

Range("A1", Range("A1").End(xlDown)).NumberFormat = "0"

End Sub

Selection is not needed.

Upvotes: 1

Related Questions