Multiple coloumns data

D

dok112

I am not sure if this is possible or not, probably is, but i'm still
beginner in the world of macros. Gotta love your bosses!! :rolleyes:
What I'm trying to do, is take a productivity report, and color cod
the different values. I already have the macro written for this
however, my problem lays within the coloumns themselves. In on
coloumn I have two sets of data, that I want to run two macros on.
(ie. Macro1 for B1:B8 & Macro2 for B10:B15). The data for Macro1 wil
not always be B1:B8. It varies from day to day. The last data inpu
though is always automatically color coded light yellow. And th
second set of data always begins 2 cells below the last cell of th
previous.

So my question is, can I create a macro that will run Macro1 on cell
B1:B(light yellow) and Macro2 on cells B(light yellow + 2 cells):B?

If it's possible and someone can help me out I will be mos
appreciative. THANKS!!! :
 
T

Tom Ogilvy

Set rng = Columns(2).SpecialCells(xlConstants)
if rng.Areas.count > 2 then exit sub
i = 0
for each ar in rng.Areas
i = i + 1
if i = 1 then
macro1 ar
else
macro2 ar
end if
Next

However, if you colored them, you should be able to identify where to start

Why not post under a single Name.
 
D

dok112

Tom,

Thanks for your help. It's a matter of me using my computer from work
home or my laptop on the road. Sorry about the confusion. When I'
home, I go completely brain dead about passwords from work, so I end u
creating all new accounts.

Kind of have an issue. I was going back over what you said, an
checked it against my document, and realized that I was mistaken. It'
not two sets of data in one column that need to have 2 macros run on.
It is actually 2 sets of data and either the first set, or the secon
set need to have a certain macro run on it for the formatting. Th
amount of data for each set varies on a daily basis. The heading tha
starts each set is the only constant that will not change. Would I us
the same code that was provided before, or is there another way t
start it.

ie.
Idle
Hours
0:03:39
0:03:33
0:01:49
0:02:06
0:04:41
0:06:41
0:01:04
0:08:31
0:03:55


0:35:59



Call Control

0:08:40
0:09:04
0:06:02
0:15:50
0:09:11
0:07:18
0:07:05
0:08:05
0:15:50


0:08:41

I would want macro AHT to begin in the blank box right below the cel
stating Call Control and end in the cell (0:08:41) which is coded i
light yellow by the report itself.

Thanks again for all the help provided
 
T

Tom Ogilvy

Dim rng as Range
set rng = cells.find("Call Control")
if not rng is nothing then
set rng = rng.offset(1,0)
set rng = range(rng, rng.offset(1,0).End(xldown)(4))
for each cell in rng
cell.Select
AHT
Next
End if

the last cell will always have 2 blank cells separating it from the data
above
AHT works on the ActiveCell so it must be called for each

If you have to search for the cell with light yellow, then the term light
yellow is not self defining. You would need to provide the colorindex and
whether this is the only cell in the sheet so coded.
 
Top