Highlighting a specific range 
Author Message
 Highlighting a specific range

I have instructed my spreadsheet to find the top cell in the last column in
Sheet 1, a Sheet to which columns are added on a daily basis with the
following:

    Sheets("Sheet 1").Range("IV2").End(xlToLeft).Select

How do I instruct it to highlight everything in this column downwards from
this cell until it reaches the last cell in the column with anything in it
-as this can change on a daily basis?  Inotherwords, I don't want to
highlight the entire column.

Any ideas?

Kind regards

Michelle



Mon, 31 May 2004 22:02:28 GMT  
 Highlighting a specific range
Here's one way:

Option Explicit

Sub testme3()

Dim rng As Range
Dim topcell As Range
Dim botcell As Range

With Worksheets("Sheet 1")
    Set topcell = .Range("Iv2").End(xlToLeft)
    Set botcell = .Cells(.Rows.Count, topcell.Column).End(xlUp)
    Set rng = Range(topcell, botcell)
End With

rng.Select

End Sub

You could put all that stuff in one expression, but those long expressions
confuse me.

Quote:

> I have instructed my spreadsheet to find the top cell in the last column in
> Sheet 1, a Sheet to which columns are added on a daily basis with the
> following:

>     Sheets("Sheet 1").Range("IV2").End(xlToLeft).Select

> How do I instruct it to highlight everything in this column downwards from
> this cell until it reaches the last cell in the column with anything in it
> -as this can change on a daily basis?  Inotherwords, I don't want to
> highlight the entire column.

> Any ideas?

> Kind regards

> Michelle

--

Dave Peterson



Mon, 31 May 2004 22:39:54 GMT  
 Highlighting a specific range
Dave

It works perfectly - just what I needed!

Many thanks

Kind regards

Michelle


Quote:
> Here's one way:

> Option Explicit

> Sub testme3()

> Dim rng As Range
> Dim topcell As Range
> Dim botcell As Range

> With Worksheets("Sheet 1")
>     Set topcell = .Range("Iv2").End(xlToLeft)
>     Set botcell = .Cells(.Rows.Count, topcell.Column).End(xlUp)
>     Set rng = Range(topcell, botcell)
> End With

> rng.Select

> End Sub

> You could put all that stuff in one expression, but those long expressions
> confuse me.


> > I have instructed my spreadsheet to find the top cell in the last column
in
> > Sheet 1, a Sheet to which columns are added on a daily basis with the
> > following:

> >     Sheets("Sheet 1").Range("IV2").End(xlToLeft).Select

> > How do I instruct it to highlight everything in this column downwards
from
> > this cell until it reaches the last cell in the column with anything in
it
> > -as this can change on a daily basis?  Inotherwords, I don't want to
> > highlight the entire column.

> > Any ideas?

> > Kind regards

> > Michelle

> --

> Dave Peterson




Tue, 01 Jun 2004 02:56:35 GMT  
 Highlighting a specific range
When you say "highlight", what do you mean?  Do you mean
select the cells or do you mean highlight them with a
color?

Joe

Quote:
>-----Original Message-----
>I have instructed my spreadsheet to find the top cell in
the last column in
>Sheet 1, a Sheet to which columns are added on a daily
basis with the
>following:

>    Sheets("Sheet 1").Range("IV2").End(xlToLeft).Select

>How do I instruct it to highlight everything in this

column downwards from
Quote:
>this cell until it reaches the last cell in the column
with anything in it
>-as this can change on a daily basis?  Inotherwords, I
don't want to
>highlight the entire column.

>Any ideas?

>Kind regards

>Michelle

>.



Tue, 01 Jun 2004 02:53:34 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. highlight range without knowing the range beforehand

2. naming ranges without specific range references

3. How to highlight specific cell?

4. highlighting a specific record's field

5. Highlight a specific record in datasheet view

6. Highlighting a Specific Row in a SubForm

7. Highlighting a specific control in a Continuous Form

8. Highlight specific results in a report

9. "Highlighting" specific chart points

10. Highlighting specific gridlines in Excel charts


 
Powered by phpBB® Forum Software © phpBB Group