VBA input box help

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
158
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
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,909
.
Are the player names all located in the same column or are they spread out all over the sheet ?
 

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
158
.
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
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,909
.
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 ?
 

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
158
.
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 ?
Yes I have it open
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,909
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")
 

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
158
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.
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,909
.
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:

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
158
.
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
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,909
.
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 ?
 

Forum statistics

Threads
1,078,437
Messages
5,340,271
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top