Text to Columns Access VBA

G

Guest

Sub SeperateData()
Dim xls as object, xlWb as object
Dim intSelrow As Integer
Dim intTotalrows As Integer



strFile = SHARE & "Data\Trans_Freight\FR7710_All_DCs_" & strBmonth & "_BY_"
& Me.txtBusYear & ".xls"


Set xls = CreateObject("Excel.Application")
Set xlWB = xls.Workbooks.Open(strFile)

intTotalrows = xls.ActiveSheet.UsedRange.Rows.Count

For intSelrow = 1 To intTotalrows
xls.cells(intSelrow, 5).select
xls.Selection.TextToColumns Destination:=xls.cells(intSelrow, 5),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(4, 1), Array(13, 1), Array(22,
1), Array(31, 1), _
Array(39, 1), Array(52, 1), Array(67, 1)), TrailingMinusNumbers:=True

Next intSelrow

Set xls = Nothing
Set xlWB = Nothing

End Sub
 
G

Guest

Sorry forgot to ask a question. I feel like Im leaving an "xls." out in the
actual Text to columns statement. Could anyone see if there's anything wrong
with that piece of code? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top