Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default coding greenbar

Stupid fingers:

But be careful.
..range("A1" & LastRow)
may not be what you mean.

(C was supposed to be ctrl-c. I must have hit Shift-C. Doh!)


Dave Peterson wrote:

I thought that along with your requirement to only conditionally format certain
rows, you'd want to only conditionally format certain columns. And in my code,
I was only working on columns A:X.

But be careful.
C
may not be what you mean.

If lastrow is 234 (say), then this
.range("A1" & LastRow)
would be equivalent to:
.range("A1" & 234)
or
.range("A1234")
(Just that one cell)

Debra Dalgleish shows how to use a dynamic range he
http://www.contextures.com/xlNames01.html#Dynamic

You'll have to adjust the formula to only look at the cells that are included in
each of the 4 ranges. Debra's sample name looks at all of column A.

Joanne wrote:

Thanks for the code Dave.
Couple questions please

what does A:X do for the routine?
I understand .range("A1" & LastRow), but again, what is the :x added
in there for?

Also, as I understand the code when reading it, it will apply to the
entire worksheet. My users need to apply it to 3 or 4 different ranges
of the same worksheet, so I need to know how to code it using a range
'name' that will allow expansion and deletion of rows or columns (at
least this is how I understand what I read in the help files regarding
the naming of ranges and it's usefullness)

Dave Peterson wrote:

You could also use a custom format of ;;; (3 semicolons).

And if you could pick out a column that always has data when that row is used,
you could use something like:

Option Explicit
Sub testme()
Dim myRng As Range
Dim LastRow As Long

With Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

With .Range("a1:x" & LastRow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=AND($A$1<"""",MOD(ROW(),2)=1)"
.FormatConditions(1).Interior.ColorIndex = 35
End With
End With
End Sub

I used column A as my indicator column and formatted A:X (and 35 is light green
in my workbook).



Joanne wrote:

Duh
I just figured out that the value I put in the indicator cell could be
a space and I then have nothing showing. Works really sweet.

Joanne wrote:

Dave
This is how I have used your cond format code

=AND($A$1<"",MOD(ROW(),2)=1)

Then, On and Off buttons on toolbar for user with this code behind
them:
On Button
Public Sub FillCell()
With Worksheets(1).range("A1")
.Value = "On"
End With
End Sub

Off Button
Public Sub ClearContents()
Dim range
Worksheets("tblMain").range("A1").ClearContents
End Sub

And this all works great, but of course ;-), I want more!!

I am wondering if I can do the conditional formatting by code instead
so that I can name the range to apply it to - then if my user adds or
deletes cols or rows, this little trick will still work. If so, how do
I do it.

I am also wondering if the value in the indicator cell can be set to
visible=false in the code and yet be able to do the job. That way the
user never needs to see it toggle on and off, as I will be setting
this for several ranges on the same worksheet. Just would look better
I think if it can be invisible.

Warned you that I want more - I'm a 'would be' coding junkie with
woefully little skills!

Thanks for your interest in my little project
Joanne

Dave Peterson wrote:

Glad you got it working and you found out that you only had to toggle the value
in that one cell.

Joanne wrote:

This works really sweet
Thanks
Dave Peterson wrote:

=AND($A$1<"",MOD(ROW(),2)=1)






--

Dave Peterson


--

Dave Peterson
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
Automatic greenbar effect, varied color, corrects with re-format Brent -- DNA Excel Worksheet Functions 1 February 11th 06 06:05 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
how do I create greenbar paper simulation in Excel? No Name Excel Programming 1 September 16th 04 03:13 PM
how do I create greenbar paper simulation in Excel? Precious Pooh Excel Programming 0 September 16th 04 02:31 PM


All times are GMT +1. The time now is 03:44 PM.

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

About Us

"It's about Microsoft Excel"