I have a shared workbook. File size is not huge, less than 1mb. When saved, saves within about 2-3 seconds.
I use a userform with textboxes and a command button to write data from all the textboxes, to the next available row on a worksheet within that workbook.
There are about 4 people using the same file, and they are using this method (fill out fields, click Submit, data gets written to next avail. row on another sheet) about 100 times a day , total. Or about 25 times per person.
They pretty frequently get the pop-up, about Saving Conflicts. Accept Mine? Accept Others? Etc. (I know I could cover this up by sharing the file and telling excel to always accept the changes being saved).
But I don't get why this could happen so often??
The code works fine, here it is below. You can see I make sure to SAVE the workbook as soon as data is written. I mean this whole data entry thing (as far as the code running at the end), takes a couple seconds. What are the chances that multiple times per day, someone else is likely to be running code that is targeting the EXACT same cell at the EXACT same moment?
Or am I missing this or not understanding it? What could I change about the situation, or my code, to make this better? Because really no matter which one they click - accept mine, or accept others, it's bad news. Data is being lost, people are being confused.
CODE
Private Sub cmdsubmit_Click()
ThisWorkbook.Worksheets("letteritem").Visible = True
Dim targetpoint As Range
Set targetpoint = ThisWorkbook.Worksheets("letteritembatch").Range("A5000").End(xlUp).Offset(1, 0)
targetpoint.Value = Mid(frmletteritem.txtaccountnumber.Value, 10, 4)
targetpoint.Offset(0, 5).Value = StrConv(frmletteritem.txtname.Value, vbUpperCase)
targetpoint.Offset(0, 1).Value = StrConv(frmletteritem.txtaddress.Value, vbUpperCase)
targetpoint.Offset(0, 2).Value = StrConv(frmletteritem.txtcity.Value, vbUpperCase)
targetpoint.Offset(0, 3).Value = StrConv(frmletteritem.txtstate.Value, vbUpperCase)
targetpoint.Offset(0, 4).Value = frmletteritem.txtzip.Value
targetpoint.Offset(0, 6).Value = frmletteritem.txtloanoriginationfee.Value
targetpoint.Offset(0, 7).Value = frmletteritem.txtamountfinanced.Value
targetpoint.Offset(0, 8).Value = frmletteritem.txtamountpaidonyouraccounts.Value
targetpoint.Offset(0, 10).Value = frmletteritem.txtother1amount.Value
targetpoint.Offset(0, 12).Value = frmletteritem.txtother2amount.Value
targetpoint.Offset(0, 14).Value = frmletteritem.txtother3amount.Value
targetpoint.Offset(0, 16).Value = frmletteritem.txtother4amount.Value
targetpoint.Offset(0, 11).Value = StrConv(frmletteritem.txtother1name.Value, vbUpperCase)
targetpoint.Offset(0, 13).Value = StrConv(frmletteritem.txtother2name.Value, vbUpperCase)
targetpoint.Offset(0, 15).Value = StrConv(frmletteritem.txtother3name.Value, vbUpperCase)
targetpoint.Offset(0, 17).Value = StrConv(frmletteritem.txtother4name.Value, vbUpperCase)
targetpoint.Offset(0, 9).Value = frmletteritem.txtamountpaidtoyou.Value
ThisWorkbook.Save
'begin, "Will letter be imaged?" if no, then "Will another letter be printed?" and cycle back to questions
If frmletteritem.imaged = False Then
complete.Visible = True
Application.Wait (Now + TimeValue("00:00:02"))
complete.Visible = False
frmletteritem.Hide
Call LetterITEM
Exit Sub
End If
Dim xpmaccountnumber As String
xpmaccountnumber = frmletteritem.txtaccountnumber.Text
ThisWorkbook.Worksheets("letteritem").ExportAsFixedFormat Type:=xlTypePDF, Filename:=("N:\DOCUMENT MANAGEMENT\Analyst Shared Files\Imaging\Bank Direct Booking\MiscDocs\" & xpmaccountnumber & ".PDF") _
, Quality:=xlQualityMinimum, IncludeDocProperties:=False, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
complete.Visible = True
Application.Wait (Now + TimeValue("00:00:02 "))
complete.Visible = False
If frmletteritem.coborrower = True Then
frmletteritem.txtname.Text = ""
frmletteritem.txtaddress.Text = ""
frmletteritem.txtcity.Text = ""
frmletteritem.txtstate.Text = ""
frmletteritem.txtzip.Text = ""
frmletteritem.txtname.SetFocus
Exit Sub
End If
ThisWorkbook.Worksheets("letterachmissing").Visible = xlVeryHidden
End Sub
ThisWorkbook.Worksheets("letteritem").Visible = True
Dim targetpoint As Range
Set targetpoint = ThisWorkbook.Worksheets("letteritembatch").Range("A5000").End(xlUp).Offset(1, 0)
targetpoint.Value = Mid(frmletteritem.txtaccountnumber.Value, 10, 4)
targetpoint.Offset(0, 5).Value = StrConv(frmletteritem.txtname.Value, vbUpperCase)
targetpoint.Offset(0, 1).Value = StrConv(frmletteritem.txtaddress.Value, vbUpperCase)
targetpoint.Offset(0, 2).Value = StrConv(frmletteritem.txtcity.Value, vbUpperCase)
targetpoint.Offset(0, 3).Value = StrConv(frmletteritem.txtstate.Value, vbUpperCase)
targetpoint.Offset(0, 4).Value = frmletteritem.txtzip.Value
targetpoint.Offset(0, 6).Value = frmletteritem.txtloanoriginationfee.Value
targetpoint.Offset(0, 7).Value = frmletteritem.txtamountfinanced.Value
targetpoint.Offset(0, 8).Value = frmletteritem.txtamountpaidonyouraccounts.Value
targetpoint.Offset(0, 10).Value = frmletteritem.txtother1amount.Value
targetpoint.Offset(0, 12).Value = frmletteritem.txtother2amount.Value
targetpoint.Offset(0, 14).Value = frmletteritem.txtother3amount.Value
targetpoint.Offset(0, 16).Value = frmletteritem.txtother4amount.Value
targetpoint.Offset(0, 11).Value = StrConv(frmletteritem.txtother1name.Value, vbUpperCase)
targetpoint.Offset(0, 13).Value = StrConv(frmletteritem.txtother2name.Value, vbUpperCase)
targetpoint.Offset(0, 15).Value = StrConv(frmletteritem.txtother3name.Value, vbUpperCase)
targetpoint.Offset(0, 17).Value = StrConv(frmletteritem.txtother4name.Value, vbUpperCase)
targetpoint.Offset(0, 9).Value = frmletteritem.txtamountpaidtoyou.Value
ThisWorkbook.Save
'begin, "Will letter be imaged?" if no, then "Will another letter be printed?" and cycle back to questions
If frmletteritem.imaged = False Then
complete.Visible = True
Application.Wait (Now + TimeValue("00:00:02"))
complete.Visible = False
frmletteritem.Hide
Call LetterITEM
Exit Sub
End If
Dim xpmaccountnumber As String
xpmaccountnumber = frmletteritem.txtaccountnumber.Text
ThisWorkbook.Worksheets("letteritem").ExportAsFixedFormat Type:=xlTypePDF, Filename:=("N:\DOCUMENT MANAGEMENT\Analyst Shared Files\Imaging\Bank Direct Booking\MiscDocs\" & xpmaccountnumber & ".PDF") _
, Quality:=xlQualityMinimum, IncludeDocProperties:=False, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
complete.Visible = True
Application.Wait (Now + TimeValue("00:00:02 "))
complete.Visible = False
If frmletteritem.coborrower = True Then
frmletteritem.txtname.Text = ""
frmletteritem.txtaddress.Text = ""
frmletteritem.txtcity.Text = ""
frmletteritem.txtstate.Text = ""
frmletteritem.txtzip.Text = ""
frmletteritem.txtname.SetFocus
Exit Sub
End If
ThisWorkbook.Worksheets("letterachmissing").Visible = xlVeryHidden
End Sub