Hi,
it would be very helpful if you could share the code you are having issues with - plenty here to assist you
Dave
Will do. I used the example in my message because it was to complicated to explain what I am doing. Let me see if I can explain. I look at medical records and remove (black out/redact) items that can not be seen by unauthorized individuals and I need to keep track of what I have redact or what pages I have removed. This is my coding for the New Page and form.
Private Sub cmbNewPage_Click()
Dim wks As Worksheet
Dim AddNew As Range
Dim x As Integer
Dim strCode As String
Dim strtext As String
Dim strh As String
Dim inti As Integer
Dim rownumber As LoadPictureConstants
Dim sht As Worksheet
Set wks = Sheets("Exemption Log")
Set AddNew = wks.Range("A65356").End(xlUp).Offset(1, 0)
'The button will transfer the information to the spread sheet and open the Page Form.
Worksheets("Exemption Log").Cells(3, 2).Value = TxtCaseNumber.Text
Worksheets("Exemption Log").Cells(5, 2).Value = TxtRespondentName.Text
AddNew.Offset(0, 0).Value = FolderNameTxt.Text
AddNew.Offset(0, 1).Value = DocUnderMainFileTxt.Text
AddNew.Offset(0, 2).Value = OrigNumberPagesTxt.Text
AddNew.Offset(0, 4).Value = HeldAttyWorkProduct.Text
AddNew.Offset(0, 5).Value = PageNumberRedaction.Text
AddNew.Offset(0, 9).Value = TxtNotes.Text
AddNew.Offset(0, 3).Value = HeldOrigPg.Text
'Clearing data fields of userform
PageNumberRedaction.Value = ""
HeldOrigPg.Value = ""
HeldAttyWorkProduct.Value = ""
HeldRCM.Value = ""
Dim z As Integer
Set sht = Sheets("exemption log")
rownumber = 15
''sace H and I
'On Error Resume Next
On Error GoTo errhandler
For x = 1 To 7
If x = 1 Then
strCode = "R"
ElseIf x = 2 Then
strCode = "P"
ElseIf x = 3 Then
strCode = "PC"
ElseIf x = 4 Then
strCode = "C"
ElseIf x = 5 Then
strCode = "O"
ElseIf x = 6 Then
strCode = "RC"
ElseIf x = 7 Then
strCode = "A"
End If
For z = 1 To 13
If z = 1 Then
strtext = "Name"
ElseIf z = 2 Then
strtext = "Address"
ElseIf z = 3 Then
strtext = "Phone"
ElseIf z = 4 Then
strtext = "Cell"
ElseIf z = 5 Then
strtext = "SSN"
ElseIf z = 6 Then
strtext = "dOB"
ElseIf z = 7 Then
strtext = "Email"
ElseIf z = 8 Then
strtext = "DEA"
ElseIf z = 9 Then
strtext = "NPI"
ElseIf z = 10 Then
strtext = "MedicalInfo"
ElseIf z = 11 Then
strtext = "MentalHealth"
ElseIf z = 12 Then
strtext = "Opinion"
ElseIf z = 13 Then
strtext = "Product"
End If
If txtboxexists("txt_" & strCode & "_" & strtext, Me) = True Then
If FrmDataEntry("txt_" & strCode & "_" & strtext) <> vbNullString Then
strh = strh & "/" & FrmDataEntry("txt_" & strCode & "_" & strtext) & " " & strCode & "-" & strtext
inti = inti + CInt(FrmDataEntry("txt_" & strCode & "_" & strtext))
End If
Else
' MsgBox "txt_" & strCode & "_" & strtext
End If
nextz:
Next z
Next x
If Len(strh) > 0 Then
strh = Mid(strh, 2)
End If
AddNew.Offset(0, 7).Value = strh
AddNew.Offset(0, 8) = inti
For x = 1 To 7
If x = 1 Then
strCode = "R"
ElseIf x = 2 Then
strCode = "P"
ElseIf x = 3 Then
strCode = "PC"
ElseIf x = 4 Then
strCode = "C"
ElseIf x = 5 Then
strCode = "O"
ElseIf x = 6 Then
strCode = "RC"
ElseIf x = 7 Then
strCode = "A"
End If
For z = 1 To 13
If z = 1 Then
strtext = "Name"
ElseIf z = 2 Then
strtext = "Address"
ElseIf z = 3 Then
strtext = "Phone"
ElseIf z = 4 Then
strtext = "Cell"
ElseIf z = 5 Then
strtext = "SSN"
ElseIf z = 6 Then
strtext = "dOB"
ElseIf z = 7 Then
strtext = "Email"
ElseIf z = 8 Then
strtext = "DEA"
ElseIf z = 9 Then
strtext = "NPI"
ElseIf z = 10 Then
strtext = "MedicalInfo"
ElseIf z = 11 Then
strtext = "MentalHealth"
ElseIf z = 12 Then
strtext = "Opinion"
ElseIf z = 13 Then
strtext = "Product"
End If
If txtboxexists("txt_" & strCode & "_" & strtext, Me) = True Then
If FrmDataEntry("txt_" & strCode & "_" & strtext) <> vbNullString Then
FrmDataEntry("txt_" & strCode & "_" & strtext) = ""
End If
End If
Next z
Next x
Exit Sub
errhandler:
If Err.Number = -2147024809 Then
GoTo nextz:
End If
MsgBox Err.Number & Err.Description
TxtCaseNumber.SetFocus
End Sub