VB Code:
Private Sub CommandButton1_Click()
Dim yourstring as String
Dim Area, subarea, system, aircon, sequential
yourstring = WorkSheets("[B]sheetname[/B]").Range("A2")
Area = Left(yourstring,2)
subarea = Left(yourstring,3)
system = Left(yourstring,5)
aircon = Mid(yourstring,7,3)
sequential = Right(yourstring,2)
'... do something with the variables here
End Sub
And this will read all cells from A2 downwards (up to the first empty cell), and will be ok if they all contain text formatted as in your example:
VB Code:
Private Sub CommandButton1_Click()
Dim iRowNum as Integer
Dim yourstring as String
Dim Area, subarea, system, aircon, sequential
iRowNum = 2
Do
yourstring = WorkSheets("[B]sheetname[/B]").Cells (iRowNum,1)
If yourstring <> "" Then
Area = Left(yourstring,2)
subarea = Left(yourstring,3)
system = Left(yourstring,5)
aircon = Mid(yourstring,7,3)
sequential = Right(yourstring,2)
'... do something with the variables here
End If
iRowNum = iRowNum + 1
Loop While yourstring <> ""
End Sub