Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 563
- Office Version
- 365
- 2010
- Platform
- Windows
Code:
Private Sub cmdbtnDone_Click()
Dim r As Range, r1 As Range
Dim SRfrm As String
Set r = Range(RefEdit1)
Set r1 = r(1)
[COLOR=#ff0000] SRfrm = selectFilefrm.txtbxSelectFile.Value[/COLOR]
Load Chattemfrm
Chattemfrm.cmbSDPFLine.Value = ActiveWorkbook.Name
Chattemfrm.cmbPrdCde.Value = r1.Offset(0, -6).Value
Chattemfrm.txtBxLtNum.Value = r1.Offset(0, -3).Value
Chattemfrm.txtBxShopNumber.Value = r1.Offset(0, 1).Value
Chattemfrm.txtbxVndrLtNu.Value = r1.Offset(0, -2).Value
Chattemfrm.txtbxdz = Me.txtbxRangeTotal.Value
Select Case Chattemfrm.cmbSDPFLine.Value
Case Is = "SDPF - LINE 1 (SLAT).xlsx"
Chattemfrm.cmbSDPFLine.Value = "Slat"
Case Is = "SDPF - LINE 2A.xlsx"
Chattemfrm.cmbSDPFLine.Value = "Uhlmann"
Case Is = "SDPF - LINE 3.xlsx"
Chattemfrm.cmbSDPFLine.Value = "Korber"
Case Is = "SDPF - LINE 4.xlsx"
Chattemfrm.cmbSDPFLine.Value = "IMA"
End Select
Unload Me
[COLOR=#ff0000] Load SRfrm[/COLOR]
ActiveWorkbook.Close
Chattemfrm.Show
End Sub
There are multiple workbooks that the user can choose to open to obtain the data needed. So rather than doing either an IF:Then statement or a Select case to close the form when done, it would be easier to just get the file name and location from the previous form selectfilefrm. Load it making it the activeworkbook and the next line would then close it.
Originally, I removed the Dim SRfrm As String and tried to use the Set statement and I left the rest of the code the same.
Code:
Set SRfrm = selectFilefrm.txtbxSelectFile.Value
I hope my explanation really makes sense. Thank you all for your help.
Last edited: