View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
broro183[_157_] broro183[_157_] is offline
external usenet poster
 
Posts: 1
Default auto run a macro


hi m,

Here's an example with two possible (untested!) approaches with one
commented out - nb, you'll have to change the strings as needed...



VBA Code:
--------------------


Option Explicit
Private Sub Workbook_Open()
With ThisWorkbook
' If .FullName = "C:\Users\Robert\Documents\Excel\Excel Forum.com\Blah.xls" Then
If .Name = "Blah.xls" Then
'change quote number
With .ActiveSheet.Range("a1")
.FormulaR1C1 = "=NOW()"
.Calculate
.Value = .Value
.NumberFormat = "0.0000"
End With
Else
'do nothing
End If
End With
End Sub
--------------------




hth
Rob


--
broro183

Rob Brockett. Always learning & the best way to learn is to
experience...
------------------------------------------------------------------------
broro183's Profile: 333
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=194201

http://www.thecodecage.com/forumz