Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bonni Garcia   on Nov 10 In MS Office Category.

  
Question Answered By: Rebekah Walker   on Nov 10

I modified
the code to something like:

========
Sub DivBreakerCode()

Dim z As Long
Dim fdr, xtrchr, strckt As String
Dim fdrNum, fdrCode, fdrSide As String
Dim fdrNumFlag As Boolean

fdrNum = vbNullString
fdrCode = vbNullString
fdrSide = vbNullString
strckt = vbNullString
xtrchr = vbNullString

'MsgBox ActiveCell.Offset(0, -4)
strckt = ActiveCell.Offset(0, -4).Value

'MsgBox strckt

'Step thru each digit in cell
For z = 1 To Len(strckt)
xtrchr = Mid(strckt, z, 1)
If IsNumeric(xtrchr) Then
If fdrNumFlag Then
' get bkr_Side
fdrSide = fdrSide & xtrchr

Else
'MsgBox "Start Feeder Number"
fdrNum = fdrNum & xtrchr
End If

Else
fdrNumFlag = True
'MsgBox "Start Feeder Code"
fdrCode = fdrCode & xtrchr
End If
Next z 'Next digit in cell

'ActiveCell.Offset(1, 0).Select
'ActiveCell.FormulaR1C1 = "=Average(RC[-1],RC[-2])"
ActiveCell.Offset(0, 0).Value = fdrNum & fdrCode
ActiveCell.Offset(0, 1).Value = fdrCode
ActiveCell.Offset(0, 2).Value = fdrSide

End Sub

========

Share: 

 

This Question has 11 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on loop through a range name Or get search suggestion and latest updates.


Tagged: