LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 3
Exclamation HELP!!! I have written my 1st ever VBA code and need more advice....

Hi,

I am fairly new to excel itself and have been thrown in at the deep end at work. I am writing a rota for colleagues to show when they are not in, in, what work they are doing etc.... To differectiate between different roles I needed more that the 3 conditional formats that excel 2003 allows. I managed to write a crude VBA that does what I want it to do, however, I have 4 work book templates all containing 6 worksheets that need updating with this particular VBA code. In cell ranges B9:AW63 there is a data validation list which contains all the options colleagues can be in whilst at work. At the moment when i reselect the information needed the VBA code kicks in and colours in the cells as instructed, however I was wondering if there was a way due to the amout of sheets that need updating if there was a way for the VBA code to pick up the existing data and automatically change the colour of the cells without me having to go back all over again and pretty much redo all the rotas?

here is the VBA code I have written

Private Sub Worksheet_Change(ByVal Target As Range)
Dim oCell As Range
For Each oCell In Target
Select Case oCell.Value
Case Is = "Not In"
oCell.Interior.ColorIndex = 16
Case Is = "Lunch"
oCell.Interior.ColorIndex = 38
Case Is = "F L"
oCell.Interior.ColorIndex = 4
Case Is = "D F"
oCell.Interior.ColorIndex = 35
Case Is = "B C"
oCell.Interior.ColorIndex = 37
Case Is = "Recs"
oCell.Interior.ColorIndex = 39
End Select
Next oCell
End Sub


Many thanks

griff

Last edited by griffav : June 19th 12 at 01:20 PM Reason: oops
 
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
is it possible to run code written inside a cell EXCEL_LOVER Excel Programming 1 April 27th 10 09:27 AM
Advice on code Greg[_27_] Excel Programming 0 May 10th 06 04:48 PM
Little more advice on this code Greg B[_5_] Excel Programming 3 September 3rd 05 05:31 AM
Programmely written code don't work Flemming Dahl[_2_] Excel Programming 8 March 1st 04 09:27 PM
Code advice please... BruceJ[_2_] Excel Programming 1 November 13th 03 06:44 PM


All times are GMT +1. The time now is 10:05 AM.

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"