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
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
613
Office Version
2016
Platform
Windows
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?
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
613
Office Version
2016
Platform
Windows
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?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
Cross posted https://www.excelforum.com/excel-programming-vba-macros/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.
 

Adam0000007

New Member
Joined
Sep 3, 2019
Messages
4
"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.
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
613
Office Version
2016
Platform
Windows


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?
 

Adam0000007

New Member
Joined
Sep 3, 2019
Messages
4
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 :)
 

Forum statistics

Threads
1,082,359
Messages
5,364,916
Members
400,815
Latest member
Joaquin Phoenix

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top