Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlighting a block of text within a cell PSULionRP Excel Discussion (Misc queries) 3 August 18th 09 03:31 PM
Sort Block of Data lab-guy Excel Worksheet Functions 3 June 12th 09 12:46 AM
Highlighting a Block of Cells to Define the Print Area Mark[_22_] Excel Programming 8 November 18th 03 03:43 AM
Re-Arranging a Block of Data Mark[_22_] Excel Programming 4 October 4th 03 09:47 AM
Copying a block of data Rick[_11_] Excel Programming 4 August 18th 03 03:06 AM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"