Let's say I have a column of numbers in A2 going down, to a random number, such as:
0.50
1.00
1.00
1.10
1.10
And I wanted a macro to split them into Major and Minor basically.. Anything before the Period, I want moved over to Column B. Anything after the Period I would like moved to Column C, and the . Just removed completely.
So
B C
0 50
1 00
1 00
1 10
1 10
Like that开发者_JAVA技巧, Pretty simple. I don't know enough about Excel VBA to write it.
Just record the following macro:
- Copy column A to B
- Format column B as text
- Data->TextToColumn on Column B with separator "."
I would just use formulas instead of VBA. Put this in B2:
=INT(A2)
and this in C2:
=(A2-B2)*100
Then copy and paste down.
精彩评论