Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlighting a block of data
Is there a way to create a macro in an excel worksheet which could do
the following: - someone can position the cursor anywhere on the excel worksheet - macro checks all rows in that columns above where the cursor is located and below where the cursor is located. It locates any cells above and below the cursor cell where there is line formatting. It highlights in blue all of the cells in that column circumscribed at the top by a line and circumscribed at the bottom by a line (highlights in blue the block of data). The lines were created by: format cells preset: outline border: line at top of cell line at bottom of cell line style: default setting Basically, the macro would highlight in blue the block of data in the block where the person positions the cursor. For example, if the data looked like this: ____ AA BB CC DD ____ If the person put the cursor on the cell containing BB, the macro would highlight all the rows in that column where the cursor is which are below the top line and above the bottom line (the whole block of data cells containing AA,BB,CC,DD,empty cell). Thanks. Brian Kaufmann *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlighting a block of data
Sub AABB()
Dim rng As Range, rng1 As Range Dim rng2 As Range With ActiveSheet.UsedRange Set rng2 = .Rows(.Rows.Count) End With Set rng = ActiveCell Do While rng.Borders(xlTop).LineStyle = xlNone Set rng = rng.Offset(-1, 0) If rng.Row = 1 Then Exit Do Loop Set rng1 = ActiveCell Do While rng1.Borders(xlBottom).LineStyle = xlNone Set rng1 = rng1.Offset(1, 0) If rng1.Row = rng2.Row Then Exit Do Loop Range(rng, rng1).Interior.ColorIndex = 5 End Sub -- Regards, Tom Ogilvy "brian kaufmann" wrote in message ... Is there a way to create a macro in an excel worksheet which could do the following: - someone can position the cursor anywhere on the excel worksheet - macro checks all rows in that columns above where the cursor is located and below where the cursor is located. It locates any cells above and below the cursor cell where there is line formatting. It highlights in blue all of the cells in that column circumscribed at the top by a line and circumscribed at the bottom by a line (highlights in blue the block of data). The lines were created by: format cells preset: outline border: line at top of cell line at bottom of cell line style: default setting Basically, the macro would highlight in blue the block of data in the block where the person positions the cursor. For example, if the data looked like this: ____ AA BB CC DD ____ If the person put the cursor on the cell containing BB, the macro would highlight all the rows in that column where the cursor is which are below the top line and above the bottom line (the whole block of data cells containing AA,BB,CC,DD,empty cell). Thanks. Brian Kaufmann *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlighting a block of data
Thanks Tom. -- Brian
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Highlighting a block of text within a cell | Excel Discussion (Misc queries) | |||
Sort Block of Data | Excel Worksheet Functions | |||
Highlighting a Block of Cells to Define the Print Area | Excel Programming | |||
Re-Arranging a Block of Data | Excel Programming | |||
Copying a block of data | Excel Programming |