View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
John Bundy John Bundy is offline
external usenet poster
 
Posts: 772
Default A complex VBA question

sorry i can go to 56 not just 36
Sub main()
For i = 1 To 56
Cells(i, 1).Interior.ColorIndex = i
Next
End Sub

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Josh Johansen" wrote:

Thanks so much, I am going to give this a try now, is there a way to
determine what the colorindex is for the 5 colors i want to use for each day?
I will let you know how it goes once I put it in. Thanks!

"John Bundy" wrote:

You need this in the code for each button, see comments and adjust/ask
questions as needed
Private Sub CommandButton1_Click()
ActiveCell.Interior.ColorIndex = 4
Cells(1, 9) = Cells(1, 9) + Cells(ActiveCell.Row, 3)
' the last 3 assumes your number to add is in column 3
'this assumes I1 has your total, change to suit
End Sub
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Josh Johansen" wrote:

I have been attempting something for some time now and have been
unsuccesfull, maybe it is not possible, but if anyone has any ideas, please
let me know. I would like to be able to select a cell, press a push button
(there would be one for everyday of the week), that cell would then be
highlighted a specific color depending on what day button was pushed (a
different color for each day) at the same time a value from that row that the
cell was selected from would be added to a running total for each day. I
will try and describe it further this way:

abcdef 3543 8
ghijklm 4543 4
nopqrs 4564 6
tuvwxy 2342 5

I would like to select the 4543 cell, press a tuesday button, the cell would
then be highlighted the color i have selected for tuesday, and 4 would be
added to a column outside of the table to maintain a running total. I could
then select 2342 and select tuesday, the cell would be highlighted the same
color as 4543, and the running total would now equal 9. This seems difficult
and may not be possible, any ideas on how to make this work? thank you so
much.