Issue with macro, the columns are not sort

Naval_JOR

New Member
Joined
Jun 7, 2018
Messages
2
Hi Guys,
I just came to this forum out of millions of Excel forums, I'm quite new with VBA because I dont use that much. Well , here is my issue. I have a macro which is reading angles degrees from 0 to 360 , increment 15 degrees. The macro is reading well the file but somehow is given me

150
165
180
195
210
225
240
255
270
285
300
315
330
345
360
25
0
15
30
45
60
75
90
105
120

<tbody>
</tbody>

which is incorrect I would prefer from 0-360 from small value to great value. Could you please give me a help, I have spent some hours trying to find a solution in google but not luck

part of the macro below

' Convert strings to numbers and seperate








Range("Z12:Z200").Select

Selection.TextToColumns , _
Destination:=Range("Z12:Z200"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True



End Sub

the issue occurs from Range ("Z12:Z200").Select , I believe the selectiontext to Columns needs to be able to recognise the angles from 0 to 360 and sort them out wisely


Kind Regards
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to MrExcel,

How many columns of data do you have after the text is split into columns?

What is an example value for cell Z12 before running the macro?
 
Upvote 0
Welcome to MrExcel,

How many columns of data do you have after the text is split into columns?

What is an example value for cell Z12 before running the macro?
Hi, I have only 2 columns of data as you can see below ,

08.69E-01
158.69E-01
308.69E-01
458.69E-01
608.69E-01
758.69E-01
908.69E-01
1058.69E-01
1208.69E-01
1358.69E-01
1508.69E-01
1658.69E-01
1808.69E-01
1958.69E-01
2108.69E-01
2258.69E-01
2408.69E-01
2558.69E-01
2708.69E-01
2858.69E-01
3008.69E-01
3158.69E-01
3308.69E-01
3458.69E-01
3608.69E-01

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>
but then the macro is not reading properly the columns and is messing up like this

1500.86868
1650.86868
1800.86868
1950.86868
2100.86868
2250.86868
2400.86868
2550.86868
2700.86868
2850.86868
3000.86868
3150.86868
3300.86868
3450.86868
3600.86868
250
00.86868
150.86868
300.86868
450.86868
600.86868
750.86868
900.86868
1050.86868
1200.86868

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
To clarify, I'm wanting to understand the exact text in Column Z, before the Text To Columns process runs.

I'm assuming that you have only one Column of data before the Text To Columns runs.
Cell Z12 might hold a value like one of these...
0 0.86868
0 8.69E-01
"0" "0.86868"
"0" "8.69E-01"
"0 0.86868"
"0 8.69E-01"

or something similar.

Also, please check that a stand alone Sub that uses just the code you posted in Post #1 , exhibits that same behavior (ensuring the problem isn't due to another part of your code you haven't posted).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top