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: 3
Default Worksheet_Calculate

I have the following code in my work sheet (Excel 2003) for the purpose of
running a macro when a cell value is 1. This value is being moved into
another cell via OPC from Rockwell Software RSLinx. The macro saves a copy
of the workbook as the current date and time. The macro works as I like it
to as far as saving the workbook. The problem is that when the workbook is
first opened, I get a filetype mismatch error. After I stop or debug and
close the VB error, the macro works from then on without error. This is an
obvious nuisance, and I am not a VB programmer, so it is not obvoius to me.
Can someone help me? The line that is highlited in the debug is
"If Me.Range("H1").Value = "1" Then"



Private Sub Worksheet_Calculate()

If Me.Range("H1").Value = "1" Then
'MsgBox "Saving a Dated Copy...."
Application.EnableEvents = False
ActiveWorkbook.SaveCopyAs Filename:="C:\TA0_Data\" & _
Replace(ActiveWorkbook.Name, ".xls", _
" " & Format(Now, "yyyy-mm-dd-hh-mm") & ".xls")
End If
Application.EnableEvents = True

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
VBA: Worksheet_Calculate() Not being called SLL Excel Programming 2 May 2nd 07 02:47 PM
worksheet_calculate enyaw Excel Discussion (Misc queries) 2 January 26th 07 01:16 PM
worksheet_calculate enyaw Excel Discussion (Misc queries) 0 January 26th 07 08:14 AM
Worksheet_calculate() Alex Excel Programming 1 August 30th 05 10:09 PM
worksheet_calculate **help** tommyboy Excel Programming 2 June 29th 04 08:33 AM


All times are GMT +1. The time now is 09:48 PM.

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"