Userform VBA Causing Unwanted Result and Splitting data between two worksheets

NavyJack

New Member
Joined
Jul 12, 2018
Messages
5
In a userform I created to collect data, I have several textboxes, drop-downs, and checkboxes. The workbook contains two worksheets that are viewable, and a few that are hidden. The two viewable worksheets, "SurvData" and "Surveillance Data Entry" are available to store the data and "call up" the userform respectively. The issue I have is that for some reason when the Surveillance Data Entry worksheet is left in the foreground to open the userform, the data from the textboxes and drop-downs are saved to the SurvData worksheet, and the checkbox data is saved to only the Surveillance Data Entry worksheet. If the user opens the userform and clicks on the SurvData worksheet to bring it forward, then the data will actually be save entirely to just that worksheet as desired. I've included the VBA below to see if anyone can help me determine what I might have left out that would cause this to happen.

Please know that this is the first time I've written VBA and I tried my best to keep it organized, indented, and included relevant notes to help me later fix or amend as necessary.



Code:
Private Sub cmdAdd_Click()
    Dim lRow As Long
    Dim lProj As Long
    Dim ws As Worksheet
Set ws = Worksheets("SurvData")
'  ********************************************************
'             Find first empty row in the database
'  ********************************************************

lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

lProj = Me.cboProj.ListIndex

'  ********************************************************
'                  check for a Project number
'  ********************************************************

If Trim(Me.cboProj.Value) = "" Then
  Me.cboProj.SetFocus
  MsgBox "Please enter a Project"
  Exit Sub
End If

'  ********************************************************
'       Copy the data to the dropdown
'              boxes and worksheet
'  ********************************************************
With ws
  .Cells(lRow, 1).Value = Me.cboProj.Value
  .Cells(lRow, 2).Value = Me.txtDocType.Value
  .Cells(lRow, 6).Value = Me.txtJoKo.Value
  .Cells(lRow, 7).Value = Me.cboSurvTitle.Value
  .Cells(lRow, 8).Value = Me.txtDate.Value
  .Cells(lRow, 10).Value = Me.txtAuditor.Value
  .Cells(lRow, 11).Value = Me.txtItemNo.Value
  .Cells(lRow, 12).Value = Me.cboTypeItem.Value
  .Cells(lRow, 13).Value = Me.cboSeverity.Value
  .Cells(lRow, 14).Value = Me.cboRespCode.Value
  .Cells(lRow, 15).Value = Me.txtDesc1.Value
  .Cells(lRow, 16).Value = Me.txtDesc2.Value
  .Cells(lRow, 17).Value = Me.txtTGI.Value
  .Cells(lRow, 18).Value = Me.txtTSD.Value
  .Cells(lRow, 19).Value = Me.txtLoc.Value
  .Cells(lRow, 20).Value = Me.txtComp.Value
  .Cells(lRow, 21).Value = Me.txtLevel.Value
  .Cells(lRow, 22).Value = Me.txtFrame.Value
  .Cells(lRow, 23).Value = Me.txtPCLS.Value
  .Cells(lRow, 24).Value = Me.cboMetric.Value
  .Cells(lRow, 25).Value = Me.cboMetSub.Value
  .Cells(lRow, 27).Value = Me.cboProc.Value
  .Cells(lRow, 28).Value = Me.cboProcSub.Value
  .Cells(lRow, 30).Value = Me.cboProg.Value
  .Cells(lRow, 31).Value = Me.cboProgSub.Value
  
  


'  ********************************************************
'                   Below adds Option Buttons
'           Also adds Checkbox values for each attribute
'  ********************************************************


If ob1Nuc.Value = True Then
  Cells(lRow, 4).Value = "Yes"
    Else
      Cells(lRow, 4).Value = "No"

If ob1Nforn.Value = True Then
  Cells(lRow, 5).Value = "Yes"
    Else
      Cells(lRow, 5).Value = "No"
      
End If
End If

Select Case True
    
Case ckbox36a01.Value
    Cells(lRow, 29).Value = "36a01 Operator has license"
Case ckbox36a02.Value
    Cells(lRow, 29).Value = "36a02 Logbook added to manlift"
Case ckbox36a03.Value
    Cells(lRow, 29).Value = "36a03 Op manual provided"
Case ckbox36a04.Value
    Cells(lRow, 29).Value = "36a04 Signed inspection record"
Case ckbox36a05.Value
    Cells(lRow, 29).Value = "36a05 Joint delvry insp comp"
Case ckbox36a06.Value
    Cells(lRow, 29).Value = "36a06 Pre-op insp/check comp"
Case ckbox36a07.Value
    Cells(lRow, 29).Value = "36a07 Op w/prop PPE/fall prot"
Case ckbox36a08.Value
    Cells(lRow, 29).Value = "36a08 Machine operated safely"
Case ckbox36a09.Value
    Cells(lRow, 29).Value = "36a09 Machine defects noted"
Case ckbox36a10.Value
    Cells(lRow, 29).Value = "36a10 Logbook reflect crit def"
Case ckbox36a11.Value
    Cells(lRow, 29).Value = "36a11 Do Not Op tags as reqd"
Case ckbox36a12.Value
    Cells(lRow, 29).Value = "36a12 Comp cklsts to supv"
Case ckbox36a13.Value
    Cells(lRow, 29).Value = "36a13 Lessor prvd repair docs"
Case ckboxOSHf01.Value
    Cells(lRow, 32).Value = "OSHf01 GF tag has valid date/time"
Case ckboxOSHf02.Value
    Cells(lRow, 32).Value = "OSHf02 Empl know/follow GF Tag"
Case ckboxOSHf03.Value
    Cells(lRow, 32).Value = "OSHf03 Gas hoses nt unattended"
Case ckboxOSHf04.Value
    Cells(lRow, 32).Value = "OSHf04 Contractor's Tag posted"
Case ckboxOSHf05.Value
    Cells(lRow, 32).Value = "OSHf05 Cntr/SY tag no conflict"
Case ckboxOSHf06.Value
    Cells(lRow, 32).Value = "OSHf06 2nd means of lighting"
Case ckboxOSHf07.Value
    Cells(lRow, 32).Value = "OSHf07 Ventiliation is adequate"
Case ckboxOSHf08.Value
    Cells(lRow, 32).Value = "OSHf08 Pre job brief cfnd space"
Case ckboxOSHf09.Value
    Cells(lRow, 32).Value = "OSHf09 Emp know rescue proced"
Case ckboxOSHf10.Value
    Cells(lRow, 32).Value = "OSHf10 Tank watch there if req"
Case ckboxOSHf11.Value
    Cells(lRow, 32).Value = "OSHf11 Valid Gas Mon Rpt post"
Case ckboxOSHf12.Value
    Cells(lRow, 32).Value = "OSHf12 HW-Adjoin spc cert valid"
Case ckboxOSHf13.Value
    Cells(lRow, 32).Value = "OSHf13 Follow Conf Spc Cert"
Case ckboxOSHf14.Value
    Cells(lRow, 32).Value = "OSHf14 Emp in space qual4"
Case ckboxOSHf15.Value
    Cells(lRow, 32).Value = "OSHf15 Tank Watch knowledge"
Case ckboxOSHf16.Value
    Cells(lRow, 32).Value = "OSHf16 Tank Watch Comm"
Case ckboxOSHf17.Value
    Cells(lRow, 32).Value = "OSHf17 Wkr alone/unobserved"
Case ckboxOSHf18.Value
    Cells(lRow, 32).Value = "OSHf18 Man way obstructed"
Case ckboxOSHf19.Value
    Cells(lRow, 32).Value = "OSHf19 Cert legible/comp/acc"
Case ckboxOSHf20.Value
    Cells(lRow, 32).Value = "OSHf20 Cert posted at access"
Case ckboxOSHf21.Value
    Cells(lRow, 32).Value = "OSHf21 Emp use resp when req"
Case ckboxOSHf22.Value
    Cells(lRow, 32).Value = "OSHf22 Emp aware of comm w/ TW"
Case ckboxOSHf23.Value
    Cells(lRow, 32).Value = "OSHf23 Emp aware of contractor"
Case ckbox162j
    Cells(lRow, 33).Value = "162j Resp/Breath Air Def Exp"
Case ckbox161g
    Cells(lRow, 33).Value = "161g Entry/Wk Uncert Cnfd Spc"
Case ckboxOSHe22
    Cells(lRow, 32).Value = "OSHe22 Control sheet compltd"
Case ckboxOSHe12
    Cells(lRow, 32).Value = "OSHe12 Pltfrm 4ft rails"
Case ckboxOSHe02
    Cells(lRow, 32).Value = "OSHe02 Wearng fall prot if reqd"
Case ckboxOSHe03
    Cells(lRow, 32).Value = "OSHe03 Equip properly worn"
Case ckboxOSHe23
    Cells(lRow, 32).Value = "OSHe23 Propr Anchorage Pt Chsn"
Case ckboxOSHe06
    Cells(lRow, 32).Value = "OSHe06 Prot for fall obj below"
Case ckboxOSHe13
    Cells(lRow, 32).Value = "OSHe13 Wrking inside rails/line"
Case ckboxOSHe14
    Cells(lRow, 32).Value = "OSHe14 Suitble fall prt/anchrge"
Case ckboxOSHe15
    Cells(lRow, 32).Value = "OSHe15 Assigned work on roof"
Case ckboxOSHe16
    Cells(lRow, 32).Value = "OSHe16 Wrkng w/i 6' wtr w/PFD"
Case ckboxOSHe08
    Cells(lRow, 32).Value = "OSHe08 Kvlr hrns/lnyrd fr htwk"
Case ckboxOSHe17
    Cells(lRow, 32).Value = "OSHe17 Usng NO mtl abv waist"
Case ckboxOSHe09
    Cells(lRow, 32).Value = "OSHe09 Full hrns/cnct lnyrd AWP"
Case ckboxOSHe18
    Cells(lRow, 32).Value = "OSHe18 Ldr lshd/ftdblkd/hld4:1"
Case ckboxOSHe19
    Cells(lRow, 32).Value = "OSHe19 Ldr >20'cage/dvce req'd"
Case ckboxOSHe20
    Cells(lRow, 32).Value = "OSHe20 Ldr >30' lndg pltfm / rails"
Case ckboxOSHe21
    Cells(lRow, 32).Value = "OSHe21 Grab bars ext 42" & ChrW(&H22) & " " & "abv"
Case ckboxOSHj01
    Cells(lRow, 32).Value = "OSHj01 Medical Surv (MES 133)"
Case ckboxOSHj02
    Cells(lRow, 32).Value = "OSHj02 ATMS Trained"
Case ckboxOSHj03
    Cells(lRow, 32).Value = "OSHj03 Area taped red 6ft prmtr"
Case ckboxOSHj04
    Cells(lRow, 32).Value = "OSHj04 Area posted Hex Chrme"
Case ckboxOSHj05
    Cells(lRow, 32).Value = "OSHj05 FF Res p/100 or 1/2 WS"
Case ckboxOSHj06
    Cells(lRow, 32).Value = "OSHj06 HEPA vac w/brush exit"
Case ckboxOSHj07
    Cells(lRow, 32).Value = "OSHj07 Change rm or drop cloth"
Case ckboxOSHj08
    Cells(lRow, 32).Value = "OSHj08 Washing Facilities"
Case ckboxOSHj09
    Cells(lRow, 32).Value = "OSHj09 PT Cntnmnt control dust"
Case ckboxOSHj10
    Cells(lRow, 32).Value = "OSHj10 PT Vent Mechncl Remvl"
Case ckboxOSHj11
    Cells(lRow, 32).Value = "OSHj11 PT Vent on sander"
Case ckboxOSHj12
    Cells(lRow, 32).Value = "OSHj12 PT Dspble sts cvrlls glvs"
Case ckboxOSHj13
    Cells(lRow, 32).Value = "OSHj13 WD Cntnmnt enclse ops"
Case ckboxOSHj14
     Cells(lRow, 32).Value = "OSHj14 WD Vent-1LEV/wldr"
Case ckboxOSHj15
    Cells(lRow, 32).Value = "OSHj15 WD Vent-xtra exhst cs"
Case ckboxOSHj16
    Cells(lRow, 32).Value = "OSHj16 WD Wldr lthrs cvrlls glvs"
     
'Case ckbox30k01
'    Cells(lRow, 29).Value = "30k01"
'
'Case ckbox30k02
'    Cells(lRow, 29).Value = "30k02"
'
'Case ckbox30k03
'    Cells(lRow, 29).Value = "30k03"
'
'Case ckbox30k04
'    Cells(lRow, 29).Value = "30k04"
'
'Case ckbox30k05
'    Cells(lRow, 29).Value = "30k05"
'
'Case ckbox30k06
'    Cells(lRow, 29).Value = "30k06"
'
'Case ckbox30k07
'    Cells(lRow, 29).Value = "30k07"
'
'Case ckbox30k08
'    Cells(lRow, 29).Value = "30k08"
'
'Case ckbox30k09
'    Cells(lRow, 29).Value = "30k09"
'
'Case ckbox30k10
'   Cells(lRow, 29).Value = "30k10"
'
'Case ckbox30k11
'   Cells(lRow, 29).Value = "30k11"
'
'Case ckbox30k12
'  Cells(lRow, 29).Value = "30k12"
'
'Case ckbox30k13
'  Cells(lRow, 29).Value = "30k13"
'
Case ckbox30b13
    Cells(lRow, 29).Value = "30b13 AE recg energy/mag"
Case ckbox30b01
    Cells(lRow, 29).Value = "30b01 Deenrg/isolte enrgy srce"
Case ckbox30b02
    Cells(lRow, 29).Value = "30b02 AE notfid afctd emp LOTP"
Case ckbox30b04
    Cells(lRow, 29).Value = "30b04 Auth red pdlock chn att"
Case ckbox30b06
    Cells(lRow, 29).Value = "30b06 Rd pdlock att for ea emp"
Case ckbox30b14
    Cells(lRow, 29).Value = "30b14 Src deenrg\isol and eff"
Case ckbox30b12
    Cells(lRow, 29).Value = "30b12 Lock ID tag attached"
Case ckbox30b09
    Cells(lRow, 29).Value = "30b09 Wrk beyond shft LOTP cntrls"
Case ckbox30b08
    Cells(lRow, 29).Value = "30b08 Maint list LOTP coordnrs"
Case ckbox30b07
    Cells(lRow, 29).Value = "30b07 AE/LOTP traine Chap 250"
Case ckbox30b10
    Cells(lRow, 29).Value = "30b10 HzEnrgy tg cnt same info"
Case ckbox36b01
    Cells(lRow, 29).Value = "36b01 Pre-Op/MHE insp comp"
Case ckbox36b02
  Cells(lRow, 29).Value = "36b02 Traveling at safe speed"
Case ckbox36b03
  Cells(lRow, 29).Value = "36b03 Load secd/stablzd/ctrld"
Case ckbox36b04
  Cells(lRow, 29).Value = "36b04 Safty equip/safe driving"
Case ckbox36b05
  Cells(lRow, 29).Value = "36b05 Safety features working"
Case ckbox36b06
  Cells(lRow, 29).Value = "36b06 Capcty stenciled/visble"
Case ckbox36b07
  Cells(lRow, 29).Value = "36b07 Oper knows load weight"
Case ckbox36b08
  Cells(lRow, 29).Value = "36b08 Label plate legible"
Case ckbox36b09
  Cells(lRow, 29).Value = "36b09 Frk tngs 2/3 thru load"
Case ckbox36b10
  Cells(lRow, 29).Value = "36b10 Oper obeys trffc pstngs"
Case ckbox36b11
  Cells(lRow, 29).Value = "36b11 Lug nuts visbl/tires OK"
Case ckbox36b12
  Cells(lRow, 29).Value = "36b12 Attachmts/rig per inst"
Case ckbox36b13
  Cells(lRow, 29).Value = "36b13 Batt Charging Procedures"
Case ckbox30c01
  Cells(lRow, 29).Value = "30c01 Deck Openings Guarded"
Case ckbox30c02
  Cells(lRow, 29).Value = "30c02 Walk/passage clear"
Case ckbox30c03
  Cells(lRow, 29).Value = "30c03 Ladders Secure Good Cond"
Case ckbox30c04
  Cells(lRow, 29).Value = "30c04 Access Egress Bd current"
Case ckbox30c05
  Cells(lRow, 29).Value = "30c05 Adequate Lighting"
Case ckbox30c06
  Cells(lRow, 29).Value = "30c06 Gas Tags Current"
Case ckbox30c07
  Cells(lRow, 29).Value = "30c07 CASCON Location Spkrs"
Case ckbox30c08
  Cells(lRow, 29).Value = "30c08 Rigging Gear in Test Dat"
Case ckbox30c09
  Cells(lRow, 29).Value = "30c09 Hot Pipes Insulated"
Case ckbox30c10
  Cells(lRow, 29).Value = "30c10 Phones in Dry Dock Work"
Case ckbox30c11
  Cells(lRow, 29).Value = "30c11 Temp Services out of way1"
Case ckbox30c12
  Cells(lRow, 29).Value = "30c12 Exits Clear Marked Lit"
Case ckbox30c13
  Cells(lRow, 29).Value = "30c13 Haz Mat "
Case ckbox30c14
  Cells(lRow, 29).Value = "30c14 PPE Postgs Adeq Obeyed"
Case ckbox30c15
  Cells(lRow, 29).Value = "30c15 Eye Wash Station Maint"
Case ckbox30c17
  Cells(lRow, 29).Value = "30c17 Ext FB Tamper Proof Seal"
Case ckbox30c18
  Cells(lRow, 29).Value = "30c18 Ext FB 30 Day Inspection"
Case ckbox30c21
  Cells(lRow, 29).Value = "30c21 Cords in good condition"
Case ckbox30c22
  Cells(lRow, 29).Value = "30c22 In Hull Housekeeping"
Case ckbox30c23
  Cells(lRow, 29).Value = "30c23 Dry Dock Housekeeping"
Case ckbox30c24
  Cells(lRow, 29).Value = "30c24 SHT RSC Housekeeping"
Case ckbox30c25
  Cells(lRow, 29).Value = "30c25 Tanks Voids Housekeeping"
Case ckbox30c30
  Cells(lRow, 29).Value = "30c30 Fire exting easy to reach"
Case ckbox30c81
  Cells(lRow, 29).Value = "30c81 Area free smking matl"
Case ckbox30c82
  Cells(lRow, 29).Value = "30c82 Hzd properly posted"
Case ckbox30c83
  Cells(lRow, 29).Value = "30c83 Adhering to posted reqs"
Case ckbox30c84
  Cells(lRow, 29).Value = "30c84 No hzd signs cvrd/depost"
Case ckbox30a01
  Cells(lRow, 29).Value = "30a01 Area free of trip haz"
Case ckbox30a02
  Cells(lRow, 29).Value = "30a02 Elec equip good work ord"
Case ckbox30a03
  Cells(lRow, 29).Value = "30a03 Eye wash clean/full/insp"
Case ckbox30a04
  Cells(lRow, 29).Value = "30a04 Area free of comb matl4"
Case ckbox30a05
  Cells(lRow, 29).Value = "30a05 Structural"
Case ckbox30a06
  Cells(lRow, 29).Value = "30a06 Mach guards in place"
Case ckbox30a07
  Cells(lRow, 29).Value = "30a07 Proper PPE being used"
Case ckbox30a08
  Cells(lRow, 29).Value = "30a08 Approp caution signs"
Case ckbox30a09
  Cells(lRow, 29).Value = "30a09 Area free of debris"
Case ckbox30a10
  Cells(lRow, 29).Value = "30a10 Fire ext insp/pin/gage"
Case ckbox30a11
  Cells(lRow, 29).Value = "30a11 Fire exits work/not obst"
Case ckbox30a12
  Cells(lRow, 29).Value = "30a12 Adequate staging"
Case ckbox30a13
  Cells(lRow, 29).Value = "30a13 Good lift practices obs"
Case ckbox30a14
  Cells(lRow, 29).Value = "30a14 Welding Line Caps"
Case ckbox30a15
  Cells(lRow, 29).Value = "30a15 Housekeeping"
Case ckbox30a16
  Cells(lRow, 29).Value = "30a16 Electrical Panels"
Case ckbox30a17
  Cells(lRow, 29).Value = "30a17 Walkways/exits clear"
Case ckbox30a18
  Cells(lRow, 29).Value = "30a18 Proper lighting"
Case ckbox30a19
  Cells(lRow, 29).Value = "30a19 Load limits posted"
Case ckbox30a20
  Cells(lRow, 29).Value = "30a20 Proper rails"
Case ckbox30a21
  Cells(lRow, 29).Value = "30a21 Ladders/roll stairs"
Case ckbox30a22
  Cells(lRow, 29).Value = "30a22 Area free smking matl"
Case ckbox30a23
  Cells(lRow, 29).Value = "30a23 Hzd properly posted"
Case ckbox30a24
  Cells(lRow, 29).Value = "30a24 Adhering to posted reqs"
Case ckbox30a25
  Cells(lRow, 29).Value = "30a25 No hzd signs cvrd/depost"
Case ckbox18n15
  Cells(lRow, 29).Value = "18n15 HM Stored in EUSL"
Case ckbox18n16
  Cells(lRow, 29).Value = "18n16 Labels HAZCOM Compliant"
Case ckbox18n17
  Cells(lRow, 29).Value = "18n17 (M)SDSs bndr&accessible"
Case ckboxOSHd01
  Cells(lRow, 32).Value = "OSHd01 Sfty glass/sde shld wrn"
Case ckboxOSHd02
  Cells(lRow, 32).Value = "OSHd02 Req'd dbl eye prot worn"
Case ckboxOSHd03
  Cells(lRow, 32).Value = "OSHd03 Emergcy eyewsh provd"
Case ckboxOSHd04
  Cells(lRow, 32).Value = "OSHd04 Eyewash inpsected"
Case ckboxOSHd05
  Cells(lRow, 32).Value = "OSHd05 Eyewash access clear"
Case ckboxOSHd06
  Cells(lRow, 32).Value = "OSHd06 Required gloves used"
Case ckboxOSHd07
  Cells(lRow, 32).Value = "OSHd07 Electrical gloves used"
Case ckboxOSHd08
  Cells(lRow, 32).Value = "OSHd08 Required hardhat worn"
Case ckboxOSHd09
  Cells(lRow, 32).Value = "OSHd09 Hardhat not damaged"
Case ckboxOSHd10
  Cells(lRow, 32).Value = "OSHd10 Hardhat worn correctly"
Case ckboxOSHd11
  Cells(lRow, 32).Value = "OSHd11 Wdlr flm rtdt clth/lthr"
Case ckboxOSHd12
  Cells(lRow, 32).Value = "OSHd12 Shrt slv/slvlss no shpb"
Case ckboxOSHd13
  Cells(lRow, 32).Value = "OSHd13 Loose cloth/jwlr nt wrn"
Case ckboxOSHd14
  Cells(lRow, 32).Value = "OSHd14 Reqrd safty shoes worn"
Case ckboxOSHd15
  Cells(lRow, 32).Value = "OSHd15 Steel toe not expsd"
Case ckboxOSHd16
  Cells(lRow, 32).Value = "OSHd16 Foot hzd prop posted"
Case ckboxOSHd22
  Cells(lRow, 32).Value = "OSHd22 PFD worn when reqrd"
Case ckboxOSHd23
  Cells(lRow, 32).Value = "OSHd23 PFD worn properly"
    
End Select
Exit Sub
End With
End Sub

'  ********************************************************
'           Force Use of the Close button on Form
'                 Save data entered on Form
'                Exit Form Return to Workbook
'  ********************************************************
Private Sub cmdClose_Click()
    Unload Me
    
End Sub


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
    Cancel = True
    MsgBox "Please use the Close Button!"
  End If
End Sub


'  ********************************************************
'            Allows User to Close the application
'         and all windows associated leaving excel open
'  ********************************************************

Private Sub cmdQuit_Click()
    ThisWorkbook.Save
    ThisWorkbook.Close
    Application.Quit
End Sub

Private Sub MultiPage1_Change()

End Sub


'  ********************************************************
'           Open and Print a Blank Confined Space
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton1_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'           Open and Print a Blank Fall Protection
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton2_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'          Open and Print a Blank Hexavalent Chromium
'                      Surveillance Sheet
'  ********************************************************

Private Sub CommandButton3_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'                Open and Print a Blank JSA
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton4_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'            Open and Print a Blank Aerial Platform
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton5_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'               Open and Print a Blank LOTP
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton6_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'               Open and Print a Blank MHE
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton7_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'             Open and Print a Blank Ship Safety
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton8_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")    
      WordObj.Visible = True
      Set WordObj = Nothing
End Sub

'  ********************************************************
'             Open and Print a Blank Shop Safety
'                    Surveillance Sheet
'  ********************************************************

Private Sub CommandButton9_Click()
    Dim WordObj As Object
      Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open ("\\appropriate web server selected - working as desired")
    WordObj.Visible = True
      Set WordObj = Nothing
End Sub


Private Sub UserForm_Initialize()

    Me.cboProj.SetFocus
    
End Sub
 
Last edited by a moderator:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi & welcome to MrExcel
You need to put a . infront of Cells like you did to begin with
 
Last edited:
Upvote 0
Fluff, Thank you for such a quick response to this posting. I will go back and add the "." in front of the "Cells" as I did at the beginning of the VBA. As I was working through the coding, it was working fine, but of course I had the SurvData worksheet open the entire time I was testing things.
 
Upvote 0
Glad to help & thanks for the feedback.

but of course I had the SurvData worksheet open the entire time I was testing things.
We've all been there:banghead:
 
Upvote 0
Fluff, Thank you for such a quick response to this posting. I will go back and add the "." in front of the "Cells" as I did at the beginning of the VBA. As I was working through the coding, it was working fine, but of course I had the SurvData worksheet open the entire time I was testing things.

Again, I want to thank you. After adding the "." in front of "Cells" as suggested, the form now produces the desired results. With so many line items, thank goodness for find and replace to speed the process of fixing this.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top