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: 10
Default help with an event driven sub argument please

Could someone please explain how the argument Target passed-in to
the event-driven sub below.

Specifically:
1. Do I need to set the Target range within the sub body
or XL does it for me with the declaration
Target As Excel.Range
setting it to A1:maxColmaxRow? My actual range is B2:X37

2. Why the sub must be in worksheet code module (right-click
the worksheet tab and choose View Code) and my prevDay(Ref) function
and other VBA code must be in the Module1 (insert module)?

When I make a copy of the sheet within the workbook (Jul05, Aug05)
each of which has one sheet per day, will the code be repeated that
many times?

thanks in advance for your help,
/mark

'A2 of an active sheet gets [via function =prevDay(A1)] the value
'from A1 of the previous sheet. If needed this value can be overwritten
'by user (i.e. the value and the formula will be overwritten with a new value).
'If the user deletes the value in A2 the code below puts the formula
'back into the cell. (the sub was donated to me by J.E. McGimpsey)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "A2" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "=prevDay(A1)"
Application.EnableEvents = True
End If
End If
End With
End Sub


 
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 driven record locator. Malcolm McMaster[_2_] Excel Discussion (Misc queries) 1 March 10th 08 08:43 AM
Paramater driven value Andrew Excel Worksheet Functions 2 January 29th 08 12:19 PM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM
user event driven macro issue Jean-Paul Viel Excel Programming 0 September 18th 03 05:32 PM
user event driven macro issue steve Excel Programming 0 September 18th 03 05:00 PM


All times are GMT +1. The time now is 10:25 AM.

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"