• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need to Hide the Active sheet

Vipullade

Member
HI

I am using the below mentioned code to call a dataform, I do not want the datasheet to be shown when this is done, please help.

Private Sub CommandButton5_Click()

Worksheets("Main Data Sheet").Activate
ActiveCell.Activate
Worksheets("Main Data Sheet").Range("A2").Select
ActiveCell.CurrentRegion.Name = "Database"

ActiveSheet.ShowDataForm

End Sub
 
Try this code
Code:
Private Sub CommandButton5_Click()
    Application.Goto Worksheets("Main Data Sheet").Range("A2")
    ActiveCell.Value = "Database"
    ActiveSheet.ShowDataForm
End Sub
 
Is this what you mean?
See attached.
Further you should learn to have a good look at the code you are using.
For example you have ActiveCell.Activate
What does ActiveCell means, yes it is active, so there in no need to activate.
Second, you should avoid Select and Activate, it slows down code big time and it is almost never necessary.
 

Attachments

  • dataform.xlsb
    19 KB · Views: 4
Is this what you mean?
See attached.
Further you should learn to have a good look at the code you are using.
For example you have ActiveCell.Activate
What does ActiveCell means, yes it is active, so there in no need to activate.
Second, you should avoid Select and Activate, it slows down code big time and it is almost never necessary.


Belleke - Thanks, that's what I needed, I wanted to hide the "Main data Sheet", which I tested on your sheet and it works well

Again thanks, i got carried away with the code....
 
Back
Top