Can you check my code please

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,712
Office Version
  1. 2007
Platform
  1. Windows
Morning,

I have the code in use below.
I complete the TextBoxs in the userform
I see a Msg box COMPLETED ALL OK & when i click the OK button i expect it to Unload the userform but it doesnt ??
What it does is reload the userform again

Rich (BB code):
Private Sub SendToWorksheet_Click()
    ThisWorkbook.Worksheets("Sheet1").Range("P6") = Me.TextBox1.Text
    ThisWorkbook.Worksheets("Sheet1").Range("Q6") = Me.TextBox2.Text
    ThisWorkbook.Worksheets("Sheet1").Range("R6") = Me.TextBox3.Text
    ThisWorkbook.Worksheets("Sheet1").Range("S6") = Me.TextBox4.Text
    ThisWorkbook.Worksheets("Sheet1").Range("T6") = Me.TextBox5.Text
    ThisWorkbook.Worksheets("Sheet1").Range("U6") = Me.TextBox6.Text
    ThisWorkbook.Worksheets("Sheet1").Range("P7") = Me.TextBox7.Text
    ActiveWorkbook.Save
    Application.ScreenUpdating = True
   
    MsgBox "COMPLETED ALL OK", vbInformation, "SUCCESSFUL MESSAGE"
    Unload Me
   
Dim Answer As Long
Dim currentShape As Shape

Sheets("Sheet1").Range("P6:U6").Copy Sheets("Sheet1").Range("E6")
Sheets("Sheet1").Range("P7").Copy Sheets("Sheet1").Range("E7")

Sheets("Sheet1").Range("E6:J6").Copy Sheets("PRINT LABELS").Range("U5")
Sheets("Sheet1").Range("E7").Copy Sheets("PRINT LABELS").Range("U6")

Sheets("Sheet1").Range("E6:J6").Copy Sheets("PRINT LABELS").Range("E5")
Sheets("Sheet1").Range("E7").Copy Sheets("PRINT LABELS").Range("E6")

Sheets("PRINT LABELS").Range("E6").Font.Color = vbWhite
Sheets("PRINT LABELS").Range("E6").Borders.LineStyle = xlNone


Sheets("PRINT LABELS").Range("U6").Font.Color = vbWhite
Sheets("PRINT LABELS").Range("U6").Borders.LineStyle = xlNone


Sheets("PRINT LABELS").Activate
ActiveSheet.Range("X1").Select

Sheets("Sheet1").Activate
ActiveSheet.Range("E7").Select

    Application.ScreenUpdating = False
   
  
    With Sheets("PRINT LABELS")
        .Range("M1").ClearContents
        For Each currentShape In .Shapes
            If currentShape.Type = msoPicture Then
                currentShape.Delete
            End If
        Next currentShape
    End With
   
    Application.ScreenUpdating = True
   
ActiveWorkbook.Save

MsgBox "NOW PASTE CODE ONTO WEBSITE", vbInformation, "Sucessful Transfer"

With Sheets("PRINT LABELS")
.Activate
.Range("AE1").Copy
.Range("A1").Select
ActiveWorkbook.FollowHyperlink Address:="http://www.reeves.tv/mini.html"
End With
End Sub
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,712
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Thanks for the reply,spotted the mistake in another code which would cause the error.

Thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,114,524
Messages
5,548,553
Members
410,848
Latest member
anuradhagrewal
Top