View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob K. Bob K. is offline
external usenet poster
 
Posts: 3
Default Start relative reference macro from specific cell

This is probably very simple but I can't figure it out. I have button
activated relative reference macros that fill hours worked, total
hours for the day, etc. on time cards. The user selects the first
cell of a particular day (correct cell highlighted in yellow) and then
the button for the shift that he worked that day. Nothing fancy.

The problem is that I don't want the macro to run unless the correct,
yellow-highlighted cell is selected. If the user selects an incorrect
cell and then attempts to run the macro, I want the macro to end
without running and possibly give the user an error message box. The
message box isn't mandatory as long as the macro doesn't run.

I've tried if/then statements based on the active cell but can't get
it to work. Any suggestions?

This is a simplified version of my typical macro; after it fills
cells, the cursor returns to the first cell, which would be my
"starting-point" yellow cell.

ActiveCell.FormulaR1C1 = "'0700"
ActiveCell.Offset (0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "1500"
ActiveCell.Offset (0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "8"
ActiveCell.Offset (0, -2).Range("A1").Select
End Sub

Thanks for any help.