Majawat
New Member
- Joined
- Jun 14, 2011
- Messages
- 49
The F column has this following code:
I need a VBA script that only creates a border around those cells that evaulate to a value and not ""
This is the code I've tried:
This doesn't border around anything at all. When I use SpecialCells(xlFormulas) it border around everything.
The values that the VLOOKUP should possibly evaluate to are "", 1-10 if that helps. I'll gladly provide any more information as necessary.
Any help would be greatly appreciated!
Also, I know I could do the formatting with a much more elegant With statement, but for other reasons, I'd prefer not to.
Code:
=IF(ISERROR(VLOOKUP(A7,Beers,2,FALSE)),"",IF(VLOOKUP(A7,Beers,2,FALSE)=0,"",VLOOKUP(A7,Beers,2,FALSE)))
I need a VBA script that only creates a border around those cells that evaulate to a value and not ""
This is the code I've tried:
Code:
Dim LastRating
LastRating = Cells(Cells.Rows.Count, "A").End(xlUp).Row
On Error Resume Next
Range("F4:F" & LastRating).SpecialCells(xlNumbers).Select
Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
Selection.Borders(xlEdgeTop).LineStyle = xlContinuous
Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous
Selection.Borders(xlEdgeRight).LineStyle = xlContinuous
Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous
The values that the VLOOKUP should possibly evaluate to are "", 1-10 if that helps. I'll gladly provide any more information as necessary.
Any help would be greatly appreciated!
Also, I know I could do the formatting with a much more elegant With statement, but for other reasons, I'd prefer not to.