![]() |
#2
|
||||
|
||||
![]()
It's me again, Keith. Do you want this to execute in every worksheet of workbook, or only in a particular worksheet? I ask because for both solutions you'll write approximately the same program, but if it's to operate on only a particular worksheet then you'll store it in the "Excel Object" that corresponds to that worksheet, but if in every worksheet then you'll put it in the ThisWorkbook object. You can see those in your VBA editor under "Microsoft Excel Objects" rather than "Modules".
(And by the way I'm assuming that you already know something about the VBA editor. If you don't—if this'll be your first macro—I should back up and start at the beginning.) The macro you write will be named "Worksheet_Change"—it must have that exact name, because that way you cause it to respond to an event with that exact name—and it has to have the prescribed list of arguments with exactly the right data types, though each argument can be named what you choose. All this is defined here; take a look. Within those limitations your macro can do whatever you like. I have a short Worksheet_Change macro that looks like this: Code:
Private Sub Worksheet_Change(ByVal Tgt As Excel.Range) If Cells(1, Tgt.Column).Value <> "From" Then Exit Sub Set co = Cells(Tgt.Row, 1) ' If there's already a date there, it'd better be today's. vd = co.Value If Not IsEmpty(vd) Then If vd <> Date Then Abend "Not today's date." End If ' Otherwise make it so. co.Value = Date End Sub |
Tags |
send cursor, vba code |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Shinaj | Excel | 2 | 05-01-2014 01:50 PM |
Macro code should find inv no in folder and send attachhed mail. | visha_1984 | Outlook | 0 | 01-30-2013 05:08 AM |
Displaying cursor position within cell | MiamiTom | Excel | 0 | 11-18-2011 09:02 AM |
![]() |
leroytrolley | Excel | 2 | 12-05-2008 02:05 AM |
![]() |
unit213 | Outlook | 1 | 09-26-2007 08:15 PM |