C
chadtastic
Hi,
All I need is to know how to use a command button in vba to store a
value in a cell in Excel.
I have a user form with two command buttons on it. one button is
labeled, "Test1", the other labeled, "Test2."
When the user clicks on the button labeled, "Test1", I want the word,
"Test1" to appear in the next available cell in row, "A." When the
user clicks onk, "Test2", I want the word, "Test2" to appear in the
next available cell in row, "A."
I want it set up so that every time the user clicks on either button,
it stores the value in the next available row without replacing the
exiisting value that is in the cell. So say the user clicks on the,
"Test1CommandButton", it stores, "Test1" in, "A1." And the next time
they click the, "Test1(or Test2)CommandButton", it stores, "Test1"(or,
"Test2"), in, "A2", ect..........Thats it.
I'm guessing the code is something like the following.......
Test1CommandButton Click()
Sheet("Sheet1").Range("A" & NextRow) = ("Test1").......??? <--something
like this?
Test2CommandButton Click()
Sheet("Sheet1".Range("A" & NextRow) = ("Test2").......??? <----again,
something like this?
I know how to store the value with an InputBox but not with a command
button and I would rather use the command button in this particular
case.
Any help would be greatly appreciated, thank you!!!
All I need is to know how to use a command button in vba to store a
value in a cell in Excel.
I have a user form with two command buttons on it. one button is
labeled, "Test1", the other labeled, "Test2."
When the user clicks on the button labeled, "Test1", I want the word,
"Test1" to appear in the next available cell in row, "A." When the
user clicks onk, "Test2", I want the word, "Test2" to appear in the
next available cell in row, "A."
I want it set up so that every time the user clicks on either button,
it stores the value in the next available row without replacing the
exiisting value that is in the cell. So say the user clicks on the,
"Test1CommandButton", it stores, "Test1" in, "A1." And the next time
they click the, "Test1(or Test2)CommandButton", it stores, "Test1"(or,
"Test2"), in, "A2", ect..........Thats it.
I'm guessing the code is something like the following.......
Test1CommandButton Click()
Sheet("Sheet1").Range("A" & NextRow) = ("Test1").......??? <--something
like this?
Test2CommandButton Click()
Sheet("Sheet1".Range("A" & NextRow) = ("Test2").......??? <----again,
something like this?
I know how to store the value with an InputBox but not with a command
button and I would rather use the command button in this particular
case.
Any help would be greatly appreciated, thank you!!!