VBABEGINER
Well-known Member
- Joined
- Jun 15, 2011
- Messages
- 1,284
- Office Version
- 365
- Platform
- Windows
Hi All,
Can any one pls help for debbugung this.
Can any one pls help for debbugung this.
Public Function FindBus()
Dim cnt As Long
Dim rw As Long
Dim p As Long
' rw counting all rows in col A
rw = Range("A" & Rows.Count).End(xlUp).Row
For cnt = 13 To rw
' "Circuits:" = in col A anywhere
' finding "Circuits:"
If Cells(cnt, 1) = "Circuits:" Then
' Assign p = the count of rows till the "Circuits:" is found.
p = Range(Cells(cnt, 1) & Rows.Count)
' cp is another variable.
' cp = row 13 to value p (count of rows till the "Circuits:" is found)
For cp = 13 To p
If Cells(10, 1).Value <> "" Then
' if above condtion is true then
' (count of rows till the "Circuits:" is found), col 1
' copy and paste it into cells(from b13,2)
Cells(cp, 1).Value = Cells(cnt, 2).Value
'Cells(cnt, 2) = Right(Cells(10, 1), 11)
'If Cells(cnt + 2, 1) = "Circuits:" Then
'p = cnt
'Exit Function
'Else
' Cells(cnt, 2) = Right(Cells(10, 1), 11)
'End If
'End If
End If
Next
Next
End Function