Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select by format

I'm trying to write a macro that can automatically select a range of
cells (across rows & columns) based on the format (bold) of the cells
above it and below it (also bold) so they can be sorted by date (which
is in one of the columns in the range). Now while the range of columns
will remain steady the number of rows will vary (and some in the
worksheet will not nedd to be sorted at all (having singular entries).
I know I can use the Offset property to select the rows below and
above, but can't figure a way of selecting the range of cells between
the two bolded cells. Does anyone know how to do this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Select by format

Start by selecting the search row, find the first cell with cell
property bold. Hold the cell reference as a variable. Search down the
colum till the next cell with bold property nad hold that as a
variable. Then the select will be first variable +1 and the second cell
will be second variable -1.

Sound like a plan, or did you want some code.

I dunno seeing your a government worker, working for CRS (j/k)

Stopher

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Select by format

Some code would be great, as I'm still scratching around with code a
bit. But if you can't see past the obviously envious position I have
at an esteemed agency such as CRS then I might be able to work it out.


Stopher wrote:
Start by selecting the search row, find the first cell with cell
property bold. Hold the cell reference as a variable. Search down the
colum till the next cell with bold property nad hold that as a
variable. Then the select will be first variable +1 and the second cell
will be second variable -1.

Sound like a plan, or did you want some code.

I dunno seeing your a government worker, working for CRS (j/k)

Stopher




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Select by format

Sub test()

Range("A2").Select
rng = Range(Selection, Selection.End(xlDown)).Count
For i = 2 To rng

If Cells(i, 1).Font.Bold = True Then
startselect = Cells(i, 1).Row + 1
Exit For
End If
Next
Range("A" & i).Select

i = i + 1

For i = i To rng

If Cells(i, 1).Font.Bold = True Then
endselect = Cells(i, 1).Row - 1
Exit For
End If
Next
Range("A" & startselect, "A" & endselect).Select

End Sub

This what you want?? If you want to go again for the next gap between
then you will have to incorperate this in another for next. Where this
will probably fails is if there is no bold line at the end. But this is
a start for what you want I guess, now that the range is selected you
can d what you want with it......

Stopher

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
Conditional Format - Doing without using .Select? pallaver Excel Discussion (Misc queries) 2 July 30th 08 07:12 AM
Select rows to format Les Stout[_2_] Excel Programming 4 October 7th 05 03:19 PM
Select a Range and Format Jaina WIlliams Excel Programming 3 March 16th 05 07:09 PM
format first row within select Jackie Excel Programming 2 January 7th 05 11:37 PM
When I select "format cells", the format dialog box does not disp. Andy S. Excel Worksheet Functions 2 November 23rd 04 03:49 AM


All times are GMT +1. The time now is 09:36 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"