Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Prav
Contributor II
Contributor II

Excel macro

Hi,

I have written a macro to export a table. And I have added a filter as an action just before running a macro in the button. Filter is working fine if the value is exists in the field and exporting table. If the particular value doesn't exists in the field, macro is running and exporting all values which is not I wanted. It should export like a blank sheet without data if that particular filter value doesn't exist. Is there any way doing this?

Thanks.

2 Replies
Prav
Contributor II
Contributor II
Author

Can anyone help me on this?

 

Thanks.

Brett_Bleess
Former Employee
Former Employee

I think what you are missing here is a condition on the button object that requires a selection, this way the button is not enabled until they select something, this way the export always has a value to reduce things upon etc.  Only way I see to accomplish what you are trying to do here.  Hope this helps give you something to try.

Things are working as expected otherwise, the only other option would be code in your macro to check if a selection has been made etc. and not processing the export and displaying a msgbox if they did not make a selection, so I guess two ways to go at things here...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.