LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default getting a macro to run when a change is made to a specific row

Do this
in the Projects window go to ThisWorkbook. under the sheetchange event write

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) " this part is generated for you
if selection.row = X (where x is the row number that activates the change) the
" your code here
end i
End Su


----- Frank Kabel wrote: ----

H
you may use an event procedure for this. See the following site fo
more details (in your case the worksheet_change event should do)
http://www.cpearson.com/excel/events.ht

-
Regard
Frank Kabe
Frankfurt, German


i have a worksheet that shows worktimes for employees, the cells ar
grey, when you enter the employees time or "shift" and press a butto
that executes my macro, it changes the colour of the "shift" to whit
to show the time scale that the employee is working. the macro run
fine, the problem is that to run the macro i have to click a button
is there a way of running the macro, or executing the code when
enter the employees "shift" of time. or is this not possible
this is the code i am using at the minute for it to run when i clic

on a button
Private Function ShadeCells(

Dim rng As Range, cell As Rang
Range("D8:AJ106").Interior.ColorIndex = 1
Set rng = Range("B8:AJ106"
For Each cell In rn
Cells.ShrinkToFit = Tru
Select Case cell.tex
Case "6~10
Range("D" & cell.row).Resize(1, 8).Interior.ColorIndex =
Case "6~11
Range("D" & cell.row).Resize(1, 10).Interior.ColorIndex =
Case "6~12
Range("D" & cell.row).Resize(1, 12).Interior.ColorIndex =
Case "6~3
Range("D" & cell.row).Resize(1, 18).Interior.ColorIndex =
Case "7~4
Range("F" & cell.row).Resize(1, 18).Interior.ColorIndex =
Case "E
Range("I" & cell.row).Resize(1, 18).Interior.ColorIndex =
Case "8~5
Range("H" & cell.row).Resize(1, 18).Interior.ColorIndex =
Case "8.30~5.30
Range("I" & cell.row).Resize(1, 18).Interior.ColorIndex =
Case "9~6
Range("J" & cell.row).Resize(1, 18).Interior.ColorIndex =
End Selec

Next cel
End Functio
thanks in advance for anything
--

Message posted from http://www.ExcelForum.com



 
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
Change a specific code to generic in VB macro Sue Excel Discussion (Misc queries) 2 April 23rd 08 06:56 PM
change the Date in cell B2 if changes are made Steved Excel Worksheet Functions 2 February 7th 08 11:55 PM
Color a cell When Change Is Made Zorro Excel Discussion (Misc queries) 5 January 24th 07 04:40 AM
Using an Excel VB-made form in cell-specific conditions. David P. A. Hunter, esq. III Excel Worksheet Functions 2 July 20th 06 03:25 AM
how do I take the changes I made on one page and change all pages Kimberly Excel Discussion (Misc queries) 0 February 13th 06 01:40 AM


All times are GMT +1. The time now is 01:02 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"