Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Active instead of a Userform

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I have a userform with various command buttons on it.

Can i add a line to these commands that leave excel active and not the userform once a command as run?

 
If you want to close the form (i.e. unload it):
Code:
Sub cmdButton1_Click()
    'Start Excel
    Unload Me
End Sub
If you still want the form loaded, you can hide it:
Code:
Sub cmdButton1_Click()
    'Start Excel
    Me.Hide
End Sub
If you want to leave the form and just move Excel to the Top
Code:
Sub cmdButton1_Click()
    'Start Excel
    xlApp.Visible = True    
End Sub
 
Thanks dsi

But could you tell me how to put it into this command:

Private Sub PlugRateP1_Click()
ActiveCell.FormulaR1C1 = "P1"
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
ActiveCell.Offset(1, 0).Select
End Sub

Cheers

Andrew
 
If you want to unload the form (i.e. you're done with it):
Code:
Private Sub PlugRateP1_Click()
    ActiveCell.FormulaR1C1 = "P1"
    With Selection.Interior
        .ColorIndex = 36
        .Pattern = xlSolid
    End With
    ActiveCell.Offset(1, 0).Select
    [COLOR=#ff0000]Unload Me[/color]
End Sub
 
Thanks dsi

But i still want the userform visible, but i want to be able to move around excel again without have to click back on the workbook.

Cheers

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top