VBA to assign car parking spaces

Adam0000007

New Member
Joined
Sep 3, 2019
Messages
4
Hi,


I'm pretty new to VBA, and was hoping someone might be able to help me with something i am trying to write:


Sheet 1 (input tab): Row 1 contains Mon-Fri, with the rows below detailing what car parking spaces are available for those days, for example, if space 18 is available on monday cell A2 will say 18.


Sheet 2 (parking list tab): this tab has employees in column A, column B dictates whether the employee needs a space or not, so they can be in a "space not needed" state, and then column C-G is the week days.


What i wanted to do was update sheet1 with any available spaces for the week and then run a macro that would then assign the spaces to employees that require a space that week, so it would not assign to those in a "space not needed" state.


I was hoping once this macro was run, sheet1 would contain no spaces so that if anymore spaces become available, we could update sheet1, run the macro, and the next employees due to receive a space would be allocated the space.


I have no idea if this is possible, but i was hoping someone might be able to help?


I look forward to any response :)


Thanks,


Adam
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Sheet 1 (input tab): Row 1 contains Mon-Fri, with the rows below detailing what car parking spaces are available for those days, for example, if space 18 is available on monday cell A2 will say 18.

so what happens when spaces 5,8,14 are also available?
do you want A2 to display all numbers available on monday? will they be separated by any special characters or spaces? this is manually inputted?
how many parking spots are there?
 
Upvote 0
What i wanted to do was update sheet1 with any available spaces for the week and then run a macro that would then assign the spaces to employees that require a space that week, so it would not assign to those in a "space not needed" state.

if employee is "space not needed" does that mean on certain days or they just never need a space?

and then column C-G is the week days.

so the parking spot number thats available from sheet 1 will move to these columns i take it?
what happens at the end of the week? do they keep the same parking schedule or does this reset weekly?
 
Upvote 0
Cross posted https://www.excelforum.com/excel-pr...1288646-vba-to-assign-car-parking-spaces.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
"so what happens when spaces 5,8,14 are also available?
do you want A2 to display all numbers available on monday? will they be separated by any special characters or spaces? this is manually inputted?
how many parking spots are there?"

So i would expect cell A3 to show 5, A4 to 8 etc etc, so it is in a list format.
this list will be manually input.
There are 200 parking spaces.

"if employee is "space not needed" does that mean on certain days or they just never need a space?"

When in this state, the employee does not need a space for that week.

"so the parking spot number thats available from sheet 1 will move to these columns i take it?
what happens at the end of the week? do they keep the same parking schedule or does this reset weekly?"

yes i hope so, so there will be a list in sheet 1 with all the available spaces, and then the macro will allocate each space to the employees in sheet 2, in the order they are listed and not giving a space when in a "space not needed" state.
And the end of the week the sheet will be reset, so sheet1 and sheet2 will be cleared out and the inputting of the manual data will begin again.

I do have a blank version of the file but am unsure on how to attach this.
 
Upvote 0


I do have a blank version of the file but am unsure on how to attach this.

you can use dropbox etc and paste the link & i'll give it a looksie.
are you open to changes if they make more sense?
 
Upvote 0
Thank you for your time, on the excel forum page i have been provided with a work around! :)

I really do appreciate the time you took out to help though :)
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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