View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Last used cell in column with shading

It may appear useless (if not understood), but it will include the shaded
cells of which you speak.

--
Regards,
Tom Ogivy


"Jim Thomlinson" wrote in message
...
I think you last solution is going to have a problem in that it looks for

the
last populated cell (Find * in LastRow function). The shaded cells are not
populated (I assume as a guess). I never use last cell. In my opinion it

is
darn near useless since you can not guarantee where it will be at any

given
time based on changes the user may have made. By the way since I don't

think
I have mentioned it before, in general I like your code. Definitely above
average with no bad habits...
--
HTH...

Jim Thomlinson


"Norman Jones" wrote:

Hi Jim,

Just by way of insider information, Dave's shading is ColorIndex 15, as

used
in your present code.

Also, your code works for me, using the file which (I think) Dave refers

to.

---
Regards,
Norman



"Jim Thomlinson" wrote in message
...
Give this a whirl. It looks for cells shaded light grey.

Sub TopBottomToggle5()
Dim rng As Range

If ActiveCell.Address < "$G$5" Then
Range("G5").Select
Else
Set rng = Range("P65536").End(xlUp).Offset(1, 0)
If rng.Interior.ColorIndex = 15 Then
Do While rng.Interior.ColorIndex = 15
Set rng = rng.Offset(1, 0)
Loop
End If
rng.Select
End If
End Sub
--
HTH...

Jim Thomlinson


"Desert Piranha" wrote:


Hi Jim,
As its written, it does the same thing mine does. I am monkeying with
it, will let you know.
Jim Thomlinson Wrote:
This should be close...

Sub TopBottomToggle5()
Dim rng As Range

If ActiveCell.Address < "$G$5" Then
Range("G5").Select
Else
Set rng = Range("P65536").End(xlUp).Offset(1, 0)
If rng.Offset(1, 0).Interior.Pattern = xlPatternGray Then
Do While rng.Interior.Pattern = xlPatternGray
Set rng = rng.Offset(1, 0)
Loop
Else
rng.Select
End If
End If
End Sub
--
HTH...

Jim Thomlinson


"Desert Piranha" wrote:


Hi all,
I use this to toggle from a cell on top of the sheet,
to the cell, one below the last used cell in Col P.

Code:
--------------------
Sub TopBottomToggle5()
If ActiveCell.Address < "$G$5" Then
Range("G5").Select
Else
Range("P65536").End(xlUp).Offset(1, 0).Select
End If
End Sub

--------------------
It works as it should. My twist is that, in Column P there may be

a
pattern in the cells below the last used cell.
The pattern is variable as far as the number of cells below the

last
used cell it will populate.
The pattern is put there by another macro, using
Code:
--------------------
Interior.Pattern = xlPatternGray8
--------------------
not conditional formating.
I am trying to make the above macro go to the "last used cell in
Column
P which includes if the cell has a pattern in it.
So say, P1:P10 have values and P11:P15 have the pattern, then my
active
cell address should be P16.

Any direction appreciated.


--
Desert Piranha




------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread:
http://www.excelforum.com/showthread...hreadid=491114




--
Desert Piranha



------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread:
http://www.excelforum.com/showthread...hreadid=491114