2007-02-15
10:53:08
·
2 answers
·
asked by
Keoki
1
in
Computers & Internet
➔ Software
I have two columns: A and B. In A, I have a list of 10 numbers. What i need to do is look at the value in cell 1A and skip that many cells in column B, then look at the value in cell 2A and shade that many cells in B and so on alternating shaded with not shaded. If, for example the numbers in column A were 1, 2, 3, 4...the first cell in column B would be unshaded. The cells 2 and 3 would be shaded. Cells 4, 5 and 6 would be unshaded and cells 7-10 would be shaded.
Ive managed to do this. The script works fine except when the value in column A is zero. The script looks at the row number of the cell location and runs an odd or even test. If the cell is in an odd position it skips that number of cells if even-it highlights that many cells. If there is a zero in an odd numbered cell than the script skips zero cells and continues on to the next cell. i now no longer have alternating highlights.
2007-02-15
11:28:38 ·
update #1
I thought that a possible solution would be to determine the action based on whether or not the cell before the active cell is highlighted or not instead of cell location. But I don’t know how to have excel distinguish a highlighted cell from one that is not highlighted.
If ActiveCell.highlighted Then don’t highlight the following cells…something like this.
2007-02-15
11:31:08 ·
update #2