yes that will work perfect how do I do that?
Posts by pritt.chris
-
-
Ok is there a way I can code the image so I don't have to press the control key?
-
That's why I started this project to learn VBA. I relate to games so creating a game based VBA project seemed like a good idea. I really want to learn this stuff and be able to assist others. The rules arn't that much different from normal monopoly the only real change is the house and hotels and there is unlimited money in the bank so to speak. I do appreciate you helping me ive been going over your code trying to figure it just for a knowledge aspect. There is only one other thing I need help with and I will be done with this project. It is not related to the userform at all if you wouldn't mind helping me with it. Due to space constraints the houses and hotels are actually pictures labeled 1-10 for each and each number has the image stacked on itself like 40 times. My question is the following is there a way I can use just one picture and when a user tries to drag it a copy is dragged instead?
-
I appreciate your hard work however I am still only able to choose between houses or hotels
ex. I pick 10 houses and 1 hotel, the 10 houses changes to 0 and hotel stays at one.I need to be able to use a combination of houses and hotels.
-
I have created A sheet with the raw data.
-
On an additional note I was playing around with your example and my version of monopoly has altered or house rules so to speak that allows up to 10 houses AND 10 hotels on a single property. I would need to be able to include that into the code I might just go with the spreadsheet idea it seems like it would be easier and it looks like you put a lot of work into it. I just didn't want anyone to be able to mess up the document but I can always hide and protect it.
-
Thank you. How do I make it so I don't have to use a spreadsheet? and one other thing I have to link the utilities with the value of dice but that will be linked to the sheet. Since I cant upload my file I will upload a screen shot.
-
I had to re-upload your file with my UserForm Imported into it because my file was to large.
-
my apologies when I viewed your document it was on my phone and I had no idea you had macros. would you like the full document or the bit about the user form? The full document is a bit messy and I'm trying to learn ways to clean it up and make it work better but like I said before I'm learning everything I'm doing through google and I'm 3 weeks in.
-
How would I do that? By array do you mean in code? I'm not familiar with VBA at all. I have all of the property information in the code. I just need to be able to have the userform pull the values from the code based on the criteria of the 3 command boxes and input it into text boxes. The code i have works but only when I click on each text box individually and press enter. What I would like to happen is the user form is opened via command button on spreadsheet. The user will select the property being referenced then select how many houses then select how many hotels and then the textbox will spit out how much rent is due within the user form. Everything works except for having to click enter on the textbox. This annoying because I have three other textboxes and have the same problem. Is their a way I can code the text box to look for changes in the comboxes and adjust accordingly?
-
Here is the code for the UserForm itself.
Code
Display MorePrivate Sub UserForm_Activate() With PropertyName .AddItem "Mediterranean Avenue" .AddItem "Baltic Avenue" .AddItem "Oriental Avenue" .AddItem "Vermont Avenue" .AddItem "Connecticut Avenue" .AddItem "St. Charles Place" .AddItem "States Avenue" .AddItem "Virginia Avenue" .AddItem "St. James Place" .AddItem "New York Avenue" .AddItem "Kentucky Avenue" .AddItem "Indiana Avenue" .AddItem "Illinois Avenue" .AddItem "Atlantic Avenue" .AddItem "Ventnor Avenue" .AddItem "Marvin Gardens" .AddItem "Pacific Avenue" .AddItem "North Carolina Avenue" .AddItem "Pennsylvania Avenue" .AddItem "Park Place" .AddItem "Boardwalk" .AddItem "Electric Company" .AddItem "Water Works" .AddItem "Reading Railroad" .AddItem "Pennsylvania Railroad" .AddItem "B. & O. Railroad" .AddItem "Short Line" End With With HouseNumber .AddItem "0" .AddItem "1" .AddItem "2" .AddItem "3" .AddItem "4" .AddItem "5" .AddItem "6" .AddItem "7" .AddItem "8" .AddItem "9" .AddItem "10" End With With HotelNumber .AddItem "0" .AddItem "1" .AddItem "2" .AddItem "3" .AddItem "4" .AddItem "5" .AddItem "6" .AddItem "7" .AddItem "8" .AddItem "9" .AddItem "10" End With End Sub
Each ComboBox does not have any code at all
The only other code is the code for the text box which is what I originally posted. When the options from the ComboBox are selected I need it to push an update to the TextBox within the same UserForm.
I hope this helps since I don't know what I'm doing its hard to relay what I'm thinking to a way you can understand.
-
There is no information in the spreadsheet everything is handled or populated through the VBA code.
-
I have UserForm with three ComboBoxes (PropertyName,HouseNumber,HotelNumber) that have hard coded options and I have a few TextBoxes (Rent) that I need to populate when a value is selected from each ComboBox. It currently only works when I press enter for each TextBox.
Code
Display MorePrivate Sub Rent_Enter() 'MEDITERRANEAN AVENUE 'houses 1-10 If InStr(PropertyName.Text, "Mediterranean Avenue") And InStr(HouseNumber.Text, "1") And InStr(HotelNumber.Text, "0") Then Rent.Value = "10" Else If InStr(PropertyName.Text, "Mediterranean Avenue") And InStr(HouseNumber.Text, "2") And InStr(HotelNumber.Text, "0") Then Rent.Value = "30" Else If InStr(PropertyName.Text, "Mediterranean Avenue") And InStr(HouseNumber.Text, "3") And InStr(HotelNumber.Text, "0") Then Rent.Value = "90" Else If InStr(PropertyName.Text, "Mediterranean Avenue") And InStr(HouseNumber.Text, "4") And InStr(HotelNumber.Text, "0") Then Rent.Value = "160"
The Code repeats with all options and ends with
I have tried Changing the Rent_Enter to something else but then it doesn't work at all. Nothing in this UserForm pulls from a spreadsheet. I'm only using it to reference predetermined static values.
I'm sorry if this is hard to read I absolutely know nothing about VBA everything I have done is from 3 weeks of google searching.