force update/"refresh" of cell & workbook_open?

T

TRM

I have some code on the "worksheet_change" event which checks to see if a
specific cell is being updated. If it is, I want to change the contents of
the adjoining cell. This seems to work, except that in order to actually
view the change (to the adjoining cell) I have to switch to a different sheet
and back. How can I force this refresh/requery. I do not work often in
Excel! I have seen "application.volatile"- and tried it- but if I understand
correctly, this command doesn't work unless the function is performed
in/under the current "target" cell- correct? Otherwise, I haven't found a
whole lot of clues. I am working with Excel 2002; but this will be installed
on to a computer with 2003.

********code for "worksheet_change"**************
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRow As Integer
Dim iColumn As Integer
iRow = Target.Row
iColumn = Target.Column
If ((iColumn = "7") And (iRow = "3")) Then
Application.EnableEvents = False
Cells(1, 1).Value = Date
Cells(8, 3).Value = 0
Application.EnableEvents = True
End If

End Sub


Also- actually, this would be a second question- I would like this same cell
(the adjoining cell) to update upon opening the document. Again, I have code
in place and working properly on "worksheet_activate"- but, if I change it to
"workbook_open"- it does not (appear to) execute.
*********** code snippet on "worksheet_activate"********
Dim intDays As Integer
Dim dtDate As Date
dtDate = Excel.Range("A1")
intDays = Date - dtDate
Application.EnableEvents = False
Excel.Range("H3").Value = intDays


THANKS!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top