I'm trying to get some existing code to a VB 6 project to work for me and I'm rather unsuccessful. The following is the Function:
VB Code:
Function BoldManyByMatch(strFind As String, OExcel As Excel.Application) As Boolean Dim cellRow As Integer With OExcel cellRow = .ActiveCell.Row .Cells.Find(What:=strFind, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate Do While cellRow < .ActiveCell.Row .Range(Selection, Selection.End(xlToRight)).Select .Selection.Font.FontStyle = "Bold" .Selection.Borders(xlDiagonalDown).LineStyle = xlNone .Selection.Borders(xlDiagonalUp).LineStyle = xlNone .Selection.Borders(xlEdgeLeft).LineStyle = xlNone With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With cellRow = .ActiveCell.Row .Cells.Find(What:=strFind, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate Debug.Print .ActiveCell.Row Loop End With BoldManyByMatch = True Exit Function End Function
I search for a string "COMBO" on excel and it borders and bolds the current and remaining cells. Unfortunatly it only captures whats right of the current field and I also need one field to the left(ie from b2:b18 and I want b1:b18). Any help with this would be much appreciated. Oh I've also tried the same code with .Range(Selection, Selection.End(x1ToLeft)).Select and that doesn't work for me. Thanks!




Reply With Quote