I've got the following piece of code that picks up a graphical "up arrow", and replaces any cells with the value of "U" with this graphic.
VB Code:
intY = 1 intX = 0 .Range("K8").Select .ActiveSheet.Shapes("UpArrow").Select .Selection.Copy On Error GoTo Next_Type With .ActiveSheet .Cells.Find(What:="U", After:=objExcel.ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate Do Until intX >= intY intX = objExcel.ActiveCell.row - 1 tmpRow = intX tmpCol = objExcel.ActiveCell.Column objExcel.Selection.PasteSpecial xlPasteAll .Cells.FindNext(After:=objExcel.ActiveCell).Activate If tmpRow = objExcel.ActiveCell.row - 1 And tmpCol = objExcel.ActiveCell.Column Then Exit Do intY = objExcel.ActiveCell.row Loop End With
The problem I've got is this .... if the only "U" cells are on the same row then the routine goes round and round in circles.
It is unlikely, unfortunately it HAS just happened (typical Monday !) !!!
I don't actually like this way of doing things anyway, as it searches row by row and takes a few minutes to complete.
Does anyone know of a better way of replacing "U" cells with my "UpArrow" graphic ?
A single Find/Replace after highlighting the affected rows would be ideal, but I don't know how to assign my "UpArrow" graphic in the "Replace" box (I'm assuming you can't do it this way).
Can anyone help ?
Thanks in advance ....




Reply With Quote