Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jay,
'----------------- Thanks for the follow-up. Yes, I see that Bob's approach properly limits the highlights to the rows in the data range. It also highlights the entire worksheet row which is fine, but I thought I'd offer the OP an alternative that also limits the highlighting to the columns in the data range. Regarding your concern, I opted for the UsedRange object to improve portability (the procedure is independent of data location). Based on standard design assumptions (no superfluous data outside the data range - as in Bob's example), I've found the procedure to be reliable in testing. My testing may have missed something or you may have something more specific (or a generality) in mind; if so, let us know. '----------------- A potential problem with the use of the UsedRange property is that it may overstate what the user perceives as the worksheets data boundaries. In this connection see Debra Dalgleish's advice on resetting the UsedRange at: http://www.contextures.com/xlfaqApp.html#Unused To limit the number of columns highlighted, a more reliable method might be to return the last data column using, for example, a function like: '========== Function LastCol(SH As Worksheet, _ Optional rng As Range) _ As Long If rng Is Nothing Then Set rng = SH.Cells End If On Error Resume Next LastCol = rng.Find(What:="*", _ After:=rng.Cells(1), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Column On Error GoTo 0 End Function '<<========== --- Regards, Norman |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
highlight subtotal rows with a fill color | Excel Worksheet Functions | |||
Color Index Code, is there any thing like that? | New Users to Excel | |||
Should be able to color code or highlight Excel worksheet tabs. | Excel Worksheet Functions | |||
Range based on interior color index? | Excel Programming | |||
excel: How can I color code rows based on a value in a cell? | Excel Discussion (Misc queries) |