Jammydodger43
New Member
- Joined
- Sep 28, 2018
- Messages
- 5
Hi,
Trying to right a simple macro to run the text to column function on the selected column and return the value to the same column but as text. I got to the below, it works if I set the range as an absolute cell reference but need it to return to the same range as I select, I have tried setting the current selection as a range and then referencing that as the range in the text to column function but it just returns the error Range of Object Global_ failed.
Any help would by massively appreciated!
James
Trying to right a simple macro to run the text to column function on the selected column and return the value to the same column but as text. I got to the below, it works if I set the range as an absolute cell reference but need it to return to the same range as I select, I have tried setting the current selection as a range and then referencing that as the range in the text to column function but it just returns the error Range of Object Global_ failed.
Code:
Sub Text_To_Column_Text()
'
' Text_To_Column_Text Macro
'
' Keyboard Shortcut: Ctrl+Shift+D
'
Dim myRange As Range
Set myRange = Selection
Selection.TextToColumns Destination:=Range("myRange"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, OtherChar _
:="/", FieldInfo:=Array(1, 2), TrailingMinusNumbers:=True
End Sub
Any help would by massively appreciated!
James
Last edited by a moderator: