View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macros/VBA to fill time card

I assume your macros work relative to the active cell when the button is
pressed - so you could do something like this:

Select Case ActiveCell.Row
Case 8
Range("G8").Vaue = "'01"
Case 14
Range("G14").Value = "'11"
End Select

--
Regards,
Tom Ogilvy


"Bob K." wrote in message
om...
I am very new to Visual Basic and hope someone can help me with this.
This is what I am trying to do.

The employee time cards at my office are complicated and
time-consuming to fill out manually. Each day has its own cells for
clock hours worked, total hours, and appropriate pay codes.
Nightshift, dayshift, holidays, etc. all require different pay codes.
H14
Monday Hours worked total code activity
0600 1400 8 01 supv

I created button-activated macros (relative reference) to fill cells
for each day and it works well. Each shift has its own button, and
can fill any day of the week However, I want the program to do this.

If the above hours were worked on Sunday (cell H8) rather than Monday
(cell H14) I want the macro to place the code "11" rather than "01" in
the H8 cell, without creating a separate macro.
H8
Sunday Hours worked total code activity
0600 1400 8 11 supv

I work shift work in law enforcement so I have a separate shift
buttons (24 in total) for all possible shift start times; I can't
create separate buttons for Sunday codes as there would be too many.

I don't know if this might require an if/then statement or something
else. Or maybe I've gone about this all wrong from the get-go.

Thanks for your help.

Bob