Brian_Richmond
New Member
- Joined
- Apr 10, 2002
- Messages
- 14
Wrote the script to convert slected range in a column to text. On my machine it works fine, but on my buddys machine it goes to cell A1 and traverses horizontally through all cells in row 1, instead of column selection. There are no frozen panes, split windows, or filters on. Do you have any suggestions about options or preferences that may be set, that would cause this.
SCRIPT:
Option Explicit
Sub Range_Conversion_To_Text()
' You can only select data in one column at a time, I haven't built horizontal
' cell selection checking or incrementation into the script. If you select more
' than one column simultaneously, your data will get injected into the 1st column,
' and corrupt whatever info you thought you had stored.
Dim Selection As Object
Dim Target As Variant
Dim Result As String
Dim Y_Axis As Integer
Y_Axis = 0
For Each Selection In ActiveCell.CurrentRegion.Cells
Target = Selection.Value
Result = Target
ActiveCell.Offset(Y_Axis, 0).ClearContents
ActiveCell.Offset(Y_Axis, 0).NumberFormat = "@"
ActiveCell.Offset(Y_Axis, 0) = Result
Y_Axis = Y_Axis + 1
Next
End Sub
SCRIPT:
Option Explicit
Sub Range_Conversion_To_Text()
' You can only select data in one column at a time, I haven't built horizontal
' cell selection checking or incrementation into the script. If you select more
' than one column simultaneously, your data will get injected into the 1st column,
' and corrupt whatever info you thought you had stored.
Dim Selection As Object
Dim Target As Variant
Dim Result As String
Dim Y_Axis As Integer
Y_Axis = 0
For Each Selection In ActiveCell.CurrentRegion.Cells
Target = Selection.Value
Result = Target
ActiveCell.Offset(Y_Axis, 0).ClearContents
ActiveCell.Offset(Y_Axis, 0).NumberFormat = "@"
ActiveCell.Offset(Y_Axis, 0) = Result
Y_Axis = Y_Axis + 1
Next
End Sub