VBA input box help

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
169
On: Sheets("Players") I have a command button, when clicked this runs:

Private Sub CommandButton1_Click()
Dim Player1 As Variant
Player1 = InputBox("Enter Player 1")
ActiveSheet.OLEObjects(1).Object.Caption = Player1
ActiveSheet.OLEObjects(1).Object.BackColor = 49152
End Sub


On: Sheets("Play") I have a command button. When it is clicked I want it to return the inputbox data from Sheets ("Players") to a corresponding cell, lets just say (A1)

If this is possible any help would be great. Thank you
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
.
Are the player names all located in the same column or are they spread out all over the sheet ?
 
Upvote 0
.
Are the player names all located in the same column or are they spread out all over the sheet ?

On the "Players" sheet. when the macro is clicked on the input box pops up and you enter the players name. The caption then on the macro button (Command button) changes to the players name.
It does not save it to a cell at this point. So as far as I know its just floating around in space lol
 
Upvote 0
.
If the names are located on that other sheet ... they must be in a specific location. Do you have that sheet to look at now ?
 
Upvote 0
I want it to return the inputbox data from Sheets ("Players")

You've said the names are located on Sheets("Players").

Are those names in a column, listed one below the other ?
Are those names on the same row extending off to the right, one name per column ?
Are those names spread out all over Sheet Players ?


There must some organization to the names located on Sheets("Players")
 
Upvote 0
You've said the names are located on Sheets("Players").

Are those names in a column, listed one below the other ?
Are those names on the same row extending off to the right, one name per column ?
Are those names spread out all over Sheet Players ?
There must some organization to the names located on Sheets("Players")

They are not located anywhere. Pretty much the input box just prompts to change the caption on the command button.
 
Upvote 0
.
Ok ... then, your initial question is not what you are saying now.

If I correctly understand, you want the user to enter a Players Name in the Input Box, and when they click OK on the Input Box
the name displayed on a button changes to the players name.

Is that correct ?
 
Last edited:
Upvote 0
.
Ok ... then, your initial question is not what you are saying now.

If I correctly understand, you want the user to enter a Players Name in the Input Box, and when they click OK on the Input Box
the name displayed on a button changes to the players name.

Is that correct ?

No... This image is Sheets (Players). So when you click on Player 1 the input box opens and you enter players name (as shown)
https://drive.google.com/open?id=1EJYHzX5mm7eWG51iPVMQoOhhFCyV1xP0

Then on the next sheet (Play) I want to click on a command button and have the input that was entered for Grandpa to be placed in A1.
I hope this makes better sense. Sorry
 
Upvote 0
.
Then on the next sheet (Play) I want to click on a command button and have the input that was entered for Grandpa to be placed in A1.

Would it make more sense, when the user click on the "Grandpa" button, 'Grandpa" is automatically entered in Cell A1 on the other sheet ?

Can I then presume you want the other player names, as they appear on the buttons on the first sheet should be added to the second sheet, below Grandpa ?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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