View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default refresh worksheet code

Hi Nowfal,

To run a worksheet procedure from a standard module, it is necessary to
change the worksheet procedure's declaration from Private ( the default) to
Public.

This done, try something like:

'========================
Sub Tester01()

Dim WB As Workbook
Const sStr As String = "Sheet1" '<<===== CHANGE

Set WB = Workbooks("MyNewTest.xls") '<<===== CHANGE

WB.Sheets(sStr).Worksheet_Calculate

End Sub

'<<========================

You may prefer, however, to consider moving the 'refesh' code portion from
the worksheet procedure to a sub in a standard module, adding a call in the
worksheet event code to the new sub. With this scenario, the 'refresh' code
sub can be run on demand like any other procedure in a standard module.

---
Regards,
Norman



"nowfal" wrote in
message ...

Hi,
I Would like to know, how can i refresh a worksheet code with in a
standard macro.
i mean i wanted to add a line of code inside the standard macro to
refresh the worksheet code. Eagerly waiting for reply.
with regards
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile:
http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=397347