Emoncada
04-13-2007, 07:22 AM
I have this code and im getting a
Compile error:
End With without with
Which i have i believe it's because of my If Statements. I hope some one can someone help with.
Private Sub CmdSavePrint_Click()
LblDate.Caption = Format(Now, "mm/dd/yyyy") & " " & Format(Now, "hh:mm:ss AM/PM")
'Add New Button to your UserForm so you press to Apply Data to Sheet
Dim RowNext As Integer
'last row of data puls one row
RowNext = Worksheets("Server Build Template").Cells(65536, 1).End(xlUp).Row + 1
'Cells(Row Number,Column Number)
With Worksheets("Server Build Template")
.Cells(RowNext, 1) = TxtName.Value
.Cells(RowNext, 2) = LblDate.Caption
.Cells(RowNext, 3) = TxtServerName.Value
.Cells(RowNext, 4) = TxtLocation.Value
If Me.ButtonG4 = True Then .Cells(RowNext, 5) = Me.LblML370G4.Caption
If Me.ButtonG5 = True Then .Cells(RowNext, 5) = Me.LblML370G5.Caption
.Cells(RowNext, 6) = TxtCtsContact.Value
.Cells(RowNext, 7) = TxtTracking.Value
If Me.Button72 = True Then .Cells(RowNext, 8) = Me.Lbl728GB.Caption
If Me.Button146 = True Then .Cells(RowNext, 8) = Me.Lbl146GB.Caption
.Cells(RowNext, 9) = TxtDrive1SN.Value
.Cells(RowNext, 10) = TxtDrive2SN.Value
.Cells(RowNext, 11) = TxtDrive3SN.Value
.Cells(RowNext, 12) = TxtDrive4SN.Value
If Me.ChkBox1721 = True Then
.Cells(RowNext, 13) = "a"
.Cells(RowNext, 14) = ServerBuild.TxtR1721.Value
If Me.ChkBox2811 = True Then
.Cells(RowNext, 15) = "a"
.Cells(RowNext, 16) = ServerBuild.TxtR2811.Value
If Me.ChkBox2620 = True Then
.Cells(RowNext, 17) = "a"
.Cells(RowNext, 18) = ServerBuild.TxtR2620.Value
If Me.Button3550 = True Then
.Cells(RowNext, 19) = Me.Lbl3550.Caption
.Cells(RowNext, 20) = ServerBuild.TxtS3550.Value
If Me.Button3560 = True Then
.Cells(RowNext, 21) = Me.Lbl3560.Caption
.Cells(RowNext, 22) = ServerBuild.TxtS3560.Value
If Me.ChkBoxCSU = True Then
.Cells(RowNext, 23) = Me.LblCSU.Caption
.Cells(RowNext, 24) = ServerBuild.TxtVCSU.Value
.Cells(RowNext, 25) = TxtFinalStatus.Value
.Cells(RowNext, 26) = TxtSignature.Value
End With
ServerBuild.PrintForm
'You can't save a worksheet
ActiveWorkbook.Save
ServerBuild.CmdClear = True
End Sub
Any ideas why
Compile error:
End With without with
Which i have i believe it's because of my If Statements. I hope some one can someone help with.
Private Sub CmdSavePrint_Click()
LblDate.Caption = Format(Now, "mm/dd/yyyy") & " " & Format(Now, "hh:mm:ss AM/PM")
'Add New Button to your UserForm so you press to Apply Data to Sheet
Dim RowNext As Integer
'last row of data puls one row
RowNext = Worksheets("Server Build Template").Cells(65536, 1).End(xlUp).Row + 1
'Cells(Row Number,Column Number)
With Worksheets("Server Build Template")
.Cells(RowNext, 1) = TxtName.Value
.Cells(RowNext, 2) = LblDate.Caption
.Cells(RowNext, 3) = TxtServerName.Value
.Cells(RowNext, 4) = TxtLocation.Value
If Me.ButtonG4 = True Then .Cells(RowNext, 5) = Me.LblML370G4.Caption
If Me.ButtonG5 = True Then .Cells(RowNext, 5) = Me.LblML370G5.Caption
.Cells(RowNext, 6) = TxtCtsContact.Value
.Cells(RowNext, 7) = TxtTracking.Value
If Me.Button72 = True Then .Cells(RowNext, 8) = Me.Lbl728GB.Caption
If Me.Button146 = True Then .Cells(RowNext, 8) = Me.Lbl146GB.Caption
.Cells(RowNext, 9) = TxtDrive1SN.Value
.Cells(RowNext, 10) = TxtDrive2SN.Value
.Cells(RowNext, 11) = TxtDrive3SN.Value
.Cells(RowNext, 12) = TxtDrive4SN.Value
If Me.ChkBox1721 = True Then
.Cells(RowNext, 13) = "a"
.Cells(RowNext, 14) = ServerBuild.TxtR1721.Value
If Me.ChkBox2811 = True Then
.Cells(RowNext, 15) = "a"
.Cells(RowNext, 16) = ServerBuild.TxtR2811.Value
If Me.ChkBox2620 = True Then
.Cells(RowNext, 17) = "a"
.Cells(RowNext, 18) = ServerBuild.TxtR2620.Value
If Me.Button3550 = True Then
.Cells(RowNext, 19) = Me.Lbl3550.Caption
.Cells(RowNext, 20) = ServerBuild.TxtS3550.Value
If Me.Button3560 = True Then
.Cells(RowNext, 21) = Me.Lbl3560.Caption
.Cells(RowNext, 22) = ServerBuild.TxtS3560.Value
If Me.ChkBoxCSU = True Then
.Cells(RowNext, 23) = Me.LblCSU.Caption
.Cells(RowNext, 24) = ServerBuild.TxtVCSU.Value
.Cells(RowNext, 25) = TxtFinalStatus.Value
.Cells(RowNext, 26) = TxtSignature.Value
End With
ServerBuild.PrintForm
'You can't save a worksheet
ActiveWorkbook.Save
ServerBuild.CmdClear = True
End Sub
Any ideas why