LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.
 
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
Macro relative cell reference decimal Excel Worksheet Functions 3 May 21st 09 11:36 PM
Relative reference? in macro TRYING Excel Worksheet Functions 3 November 20th 07 12:00 AM
Using relative reference in macro Bas Excel Discussion (Misc queries) 0 March 23rd 06 12:11 PM
Macro to copy text to a specific cell reference shanman_lmtd Excel Programming 3 July 23rd 04 03:32 PM
MACRO Relative Reference Ibrahim Awwad Excel Programming 3 September 9th 03 02:11 PM


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