Data Form Sort

Birdy92

New Member
Joined
Apr 15, 2002
Messages
14
I was trying to have a macro run (that is already made) once the user closes out the data form. I was told that using the following code would get this marco to run when I closed out the form but the only time that I can get it to run is when I close out the sheet. Am I doing something wrong here or is there more to the story??

Private Sub workbook_BeforeClose(Cancel As Boolean)
Move 'this is my macro's name
End Sub

The code is in the "ThisWorkbook" object and the data form opens automatically when Excel opens.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi Birdy,

Well as usual I am more than a little confused? Each object has it's own methods. So a Wookbook fires on the workbook events. By data form are you refering to a Worksheet or a User Form or am I totaly of base here?

Rocky...
 
Upvote 0
I understand your confusion, because I am just as confused as you on this...The main reason that I used that code was I got the same answer from two different source...When I start Excel I use the following:

Private Sub Workbook_Open()
Sheets("Test").Select
Range("A2").Select
ActiveSheet.ShowDataForm
End Sub

What I am trying to accomplish is when they click on the close button on the dataform is for the "Move" macro to run.

Hope this helps clear up both of our million points of confusion.
 
Upvote 0
Try
Private Sub UserForm_Deactivate()

End Sub

Private Sub UserForm_Terminate()

End Sub
I don't see how it can work in a Workbook method.

Still lost I guess.

Rocky...
This message was edited by Rocky E on 2002-05-08 07:23
 
Upvote 0
Nevermind Rocky.....The link that got sent to me showed me something different than what you posted.....I will give this a shot.
 
Upvote 0
Sorry about that.

Well that is a start, but what does your datform look like? I still can't see a workbook method doing what you are asking. I just don't understand enough to recommend someting. Maybe someone else does?

Rocky...
 
Upvote 0
The dataform is huge(about 24 items)....It is for our salemen to enter info for their jobs that they are working on...Right now they each have their own sheet in the workbook and all I am trying to do is to simplify the entering of their data.

I agree that the Workbook object may not be the best way to go, but this was the one answer I got to a previous post about two week ago on this board.

All I am trying to do is really clean up the entering of data for the people using this sheet. If you even have another idea on how to put this info in, and maybe the simpliest is to just put it in the old fasion way, let me know.
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,020
Members
448,543
Latest member
MartinLarkin

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