Userform not popping up when called

Damian37

Active Member
Joined
Jun 9, 2014
Messages
301
Office Version
  1. 365
Hello all,
I've set up a userform within VBA, however, when I attempt to call it using the command button I receive a "Compile Error: Method or data member not found" error. The portion of the code that is highlighted is the .Show portion. I've added the code to call on the userform as well as the code that would enter the information put in to the user form into the worksheet I've designated as the data sheet. Here's the call code:
VBA Code:
Private Sub CommandButton1_Click()

RecordEntryForm.Show

End Sub
Here's the code that would enter the data in to the worksheet once the fields have been filled. I've been unable to test this as I haven't been able to have the userform appear when the command button is clicked on.
Code:
Private Sub UserForm_Click()

Dim lRow As Long
Dim lPart As Long
Dim WS As Worksheet
Set WS = Worksheets("AllData")

lRow = WS.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

RecordEntryForm.Show
    
    
With WS
    .Cells(lRow, 1).Value = Me.StoreID.Value
    .Cells(lRow, 2).Value = Me.Division.Value
    .Cells(lRow, 3).Value = Me.Region.Value
    .Cells(lRow, 4).Value = Me.Storetype.Value
    .Cells(lRow, 5).Value = Me.Storestatus.Value
    .Cells(lRow, 6).Value = Me.DateVerify.Value
    .Cells(lRow, 7).Value = Me.StorePOC.Value
    .Cells(lRow, 8).Value = Me.POCEmail.Value
    .Cells(lRow, 9).Value = Me.StoreMgr.Value
    .Cells(lRow, 10).Value = Me.MgrEmail.Value
    .Cells(lRow, 11).Value = Me.QHContact.Value
    .Cells(lRow, 12).Value = Me.QHEmail.Value
    .Cells(lRow, 13).Value = Me.DistroBP.Value
    .Cells(lRow, 14).Value = Me.CloseDate.Value
    .Cells(lRow, 15).Value = Me.RSAName.Value
    .Cells(lRow, 16).Value = Me.RSAEmail.Value
    .Cells(lRow, 17).Value = Me.ASMName.Value
    .Cells(lRow, 18).Value = Me.ASMEmail.Value
    .Cells(lRow, 19).Value = Me.ROMName.Value
    .Cells(lRow, 20).Value = Me.ROMEmail.Value
    .Cells(lRow, 21).Value = Me.FMMName.Value
    .Cells(lRow, 22).Value = Me.FMMEmail.Value
    .Cells(lRow, 23).Value = Me.BPContact.Value
    .Cells(lRow, 24).Value = Me.City.Value
    .Cells(lRow, 25).Value = Me.State.Value
    .Cells(lRow, 26).Value = Me.BrandedPartner.Value
    .Cells(lRow, 27).Value = Me.PartnerPM.Value
    .Cells(lRow, 28).Value = Me.PMEmail.Value
    
End With
End Sub
I appreciate any help anyone can give me on this. Thank you.

Damian
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I am new to this but the userform name in code needs to match the name of the form you want to call up.

VBA Code:
Private Sub CommandButton1_Click()

RecordEntryForm.Show

End Sub

Private Sub UserForm_Click()

Did you rename your userform to RecordEntryform?

Just an idea from another newbie..
 
Upvote 0
I am new to this but the userform name in code needs to match the name of the form you want to call up.

VBA Code:
Private Sub CommandButton1_Click()

RecordEntryForm.Show

End Sub

Private Sub UserForm_Click()

Did you rename your userform to RecordEntryform?

Just an idea from another newbie..
Yes I did rename it to RecordEntryForm, and when I click on the command button, the .Show is what is highlighted for the compile error.

VBA Code:
Private Sub CommandButton1_Click()

RecordEntryForm[B].Show[/B]

End Sub
 
Upvote 0
Thank you for pointing that out to me Bill. I was calling the wrong name, once I changed it, the userform appeared. However, I was wondering if you might happen to know how to add the data entered into the userform within multiple worksheets based on a predetermined category? I.e Future Store, Existing Store, or BP Store.
 
Upvote 0
Damian,

Happy I was a little help with that.
As much as I would love to help you, my experience in coding is limited to just a couple of small projects.
Both of which I was on here getting help with. There are many on this board that would be astronomically better to help you with that.
I just come on here to try to learn a little, you were my first person I was able to help.

If you could include a link to your code and maybe a screen shot of how it needs to be, I think you will get help quicker.

One thing I learned the hard way is there are some on this site do not want there coding help shared publicly.

I Recommend if someone helps you with a chunk of code, Make a note in the code who it was that helped write that section,
and whether or not it can be posted to a public site. That way if you are several projects in and develop an issue,
you can go back to the correct person for help and will be less likely to screw up and post a section of code that you should not have.

Have a great day and good luck with the code.

Respectfully,

Bill Williamson
 
Upvote 0

Forum statistics

Threads
1,224,875
Messages
6,181,515
Members
453,050
Latest member
Obil

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