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: 64
Default Shared Workbook; Update-on-Save not working when called from code?

Function fcn_CountDataRows(wsht As Worksheet, AssayColNum As Integer)
Dim RowIndex As Long
ThisWorkbook.Save
RowIndex = 0
Do
RowIndex = RowIndex + 1
Loop Until IsEmpty(wsht.Cells(RowIndex, AssayColNum).Value)
RowIndex = RowIndex - 1
fcn_CountDataRows = RowIndex

MsgBox Title:="Debug -- Row Count", prompt:="Initial Count: " &
InitialDataSheetRowCount _
& vbCrLf & "Current Count: " & RowIndex

End Function

AssayColNum is the column number of a column on wsht that is non-empty for
all rows containing data.

InitialDataSheetRowCount is a module-level public variable. This function
is called from Workbook_Open, result is stored in InitialDataSheetRowCount.

This function is also called from a save-and-close subprocedure, operating
within a shared workbook. The objective, in that context, is to determine
whether or not any other user has added rows to wsht.

The workbook is shared under the default update-on-save option.

The issue: Called from the save-and-close subprocedure, the MsgBox
invariably reports the same value for InitialDatasheetRowCount and RowIndex.
Even when another user has added rows to the wsht (proven by history). It
appears Excel is not actually updating wsht on save.

Has anyone else seen this behavior, or have any suggestions for fixing it.
--
Today is not the worst day of my life.
 
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 Code not working on Shared Workbook KC_Cheer_Coach Excel Worksheet Functions 3 April 7th 09 06:09 PM
update pivot in shared shared workbook 00George00 Excel Discussion (Misc queries) 1 August 23rd 06 08:16 PM
how to update a shared workbook using the same cells at the same t Blair Excel Discussion (Misc queries) 0 November 26th 04 10:21 PM
Update a shared workbook. Unknown_User[_8_] Excel Programming 6 May 25th 04 09:06 PM
Save Event - Determine if called by code or user David Sedberry Excel Programming 0 October 2nd 03 04:56 PM


All times are GMT +1. The time now is 10:20 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"