ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,731
- Office Version
- 2007
- Platform
- Windows
On my worksheet in two cells should be customers name & the date.
The two cells in question only get the values entered after the userform is closed.
Take a look at text in Red
This is the code in use.
I also tried this thinking when i select a value in the ComboBox the change would then do it but NO.
The values do get entered but seems pointless the way it currently works
The two cells in question only get the values entered after the userform is closed.
Take a look at text in Red
This is the code in use.
VBA Code:
Private Sub PurchasedKey_Click()
Dim sPath As String
Dim strFileName As String
Dim sh As Worksheet
If ComboBox1 = "" Then
MsgBox "YOU DID NOT ENTER A CUSTOMERS NAME", vbCritical, "NO NAME ENTERED ON SHEET"
ComboBox1.SetFocus
Exit Sub
End If
[COLOR=rgb(184, 49, 47)] With ThisWorkbook.Worksheets("PRINT LABELS")
.Range("B3") = Me.ComboBox1.Text
.Range("E3") = Format(DateSerial(CLng(Me.cboYear.Value), Me.cboMonth.ListIndex + 1, Me.cboDay.Value), "long date")
End With[/COLOR]
Unload PrinterForm
With ActiveSheet
If .Range("P1") = "" Then
MsgBox "NO CODE SHOWN TO GENERATE PDF", vbCritical, "NO CODE ON SHEET TO CREATE PDF"
Exit Sub
End If
If .Range("N1") = "M" Then
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & " " & Format(.Range("E3").Value, "dd-mm-yyyy") & " " & .Range("P1").Value & " (SLS).pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
Else
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & ".pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
End If
With ActiveSheet
ActiveWindow.SelectedSheets.PrintOut copies:=1
MsgBox "DONT FORGET TO HYPERLINK CUSTOMER ON POSTAGE SHEET", vbInformation, "HYPERLINK DISCO II KEY MESSAGE"
End With
End With
End Sub
I also tried this thinking when i select a value in the ComboBox the change would then do it but NO.
Code:
Private Sub ComboBox1_Change()
ComboBox1 = UCase(ComboBox1)
If ComboBox1.Value > 0 Then
PurchasedKey.Visible = True
PurchasedCode.Visible = True
End If
ThisWorkbook.Worksheets("PRINT LABELS").Range("B3").Value = PrinterForm.ComboBox1.Value
End Sub
The values do get entered but seems pointless the way it currently works