Can you check my code please

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
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
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,
Thanks for the reply,spotted the mistake in another code which would cause the error.

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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