Trevor G
10-08-2010, 02:57 AM
I have an export from an SQL Server which keeps integer columns as text on the export, is there a way to convert the string to integer when I open the workbook, the columns are Y, Z, AA
I have no control over the exports so I can't get to the SQL Server
I have searched but can't find a solution, I do appoligse if this has been raised before (I am sure it has!).
If I could get the code I can then impliment this to resolve an issue for our department
I have tried the record on Text to Column but it will only let me do a single column, even if I record 3 separate macros they don't do the next one
Here is the recorded code plus the call macro
Sub convert3()
Columns("Y:Y").Select
Selection.TextToColumns Destination:=Range("Y1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("Y1").Select
End Sub
Sub convert1()
Columns("Z:Z").Select
Selection.TextToColumns Destination:=Range("Z1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("z1").Select
End Sub
Sub convert2()
Columns("AA:AA").Select
Selection.TextToColumns Destination:=Range("AA1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("AA1").Select
End Sub
Sub convert4()
Call convert1
Call convert2
Call convert3
End Sub
I have no control over the exports so I can't get to the SQL Server
I have searched but can't find a solution, I do appoligse if this has been raised before (I am sure it has!).
If I could get the code I can then impliment this to resolve an issue for our department
I have tried the record on Text to Column but it will only let me do a single column, even if I record 3 separate macros they don't do the next one
Here is the recorded code plus the call macro
Sub convert3()
Columns("Y:Y").Select
Selection.TextToColumns Destination:=Range("Y1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("Y1").Select
End Sub
Sub convert1()
Columns("Z:Z").Select
Selection.TextToColumns Destination:=Range("Z1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("z1").Select
End Sub
Sub convert2()
Columns("AA:AA").Select
Selection.TextToColumns Destination:=Range("AA1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("AA1").Select
End Sub
Sub convert4()
Call convert1
Call convert2
Call convert3
End Sub