Saving VBA Code And A Counter

Morrissey

Board Regular
Joined
Mar 8, 2002
Messages
85
Hello I have A Problem And I Need A Solution Quickly, I Have A Button Which When Clicked I Want To Do The Follwoing Things

->Copy A Selection Of My Cells from 'A1' to 'G49' (I Have Also Named These cells a range called 'export1' Onto A New Workbook

->Have This New Workbook Automatically Saved While And Then Have To Workbook Closed

When This Has Been Done 250 Times I Would Like A Message Box To Come Up Saying A Customised Message

I Need All The VB Code For This Please Help Me!
 
Just thought of another one.

Will the workbook with the command button be opened and closed? e.g. the user comes in, opens the workbook, presses the button, which copies and pastes the data, then closes the workbook.

Assume that the user has opened and closed this workbook 250 times and each time pressed the button once. Do you still want the message box to appear, since the user has actually pressed this button 250 times?

Out of interest why 250 times? I know that thread I posted before was from a fairly moronic and irrational kid, but you seem to have a bit more savvy about you. Did I see you mention your shipping company in another thread?
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
WILL THE RANGE NAMED "EXPORT1" BE OVERWRITTEN EACH TIME IT IS PASTED WILL IT BE PASTED TO A DIFFERENT PLACE ON THE TARGET WORKBOOK DOESIT MATTER IS IT IMPORTANT
 
Upvote 0
Steve, that's a good question as well. Yes, Morrissey I will need to know this as well. I was just going to overwrite the range each time, but if it needs to be appended to the existing data to create a log, this could help.
 
Upvote 0
APPENDED ON ONE SHEET I THOUGHT IT WAS TO GO ON SEPERATE SHEETS AND WHAT IS THE MESSAGE TO SAY JUST YOUV PRESSED THE BUTTON 250 TIMES OR SOMETHING ELSE
 
Upvote 0
Yes Well 250 That Is Because I Want To Save 250 Invoices Onto A CD Do I Can Save Hard Disk Space, Yes I Do Want THe NEw Data To Overwrite THe Old Data But It Will Be A Template So It Won't Matter
 
Upvote 0
Will it need to check if there is a CD in the drive Will it need to check if the CD is a writable CD Will it need to check if there is room on the CD if it is writable What kind of error message should be given if any of these happen
 
Upvote 0

Forum statistics

Threads
1,213,515
Messages
6,114,080
Members
448,548
Latest member
harryls

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