So I'm really new to VBA and I'm having a couple of problems. The goal is to press a button whilst on sheet one and for text to columns to happen on sheet 2.
So far I have this code (attached below). My main problems are that I can't seem to get it to split horizontally, I also can't seem to incoroprate a button into it.
Any help would be really appreciated!
Thanks
What I currently have:
Option Explicit
Sub splitcells()
Dim InxSplit As Long
Dim Splitcell() As String
Dim RowCrnt As Long
With Worksheets("sheet1")
RowCrnt = 1
Do While True
If .Cells(RowCrnt, "A").Value = "" Then
Exit Do
End If
Splitcell = Split(.Cells(RowCrnt, "A").Value, "/")
If UBound(Splitcell) > 0 Then
.Cells(RowCrnt, "A").Value = Splitcell(0)
For InxSplit = 1 To UBound(Splitcell)
RowCrnt = RowCrnt + 1
.Rows(RowCrnt).EntireRow.Insert
.Cells(RowCrnt, "A").Value = Splitcell(InxSplit)
.Cells(RowCrnt, "B").Value = .Cells(RowCrnt - 1, "B").Value
Next
End If
RowCrnt = RowCrnt + 1
Loop
End With
End Sub