ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using textbox for cell values (https://www.excelbanter.com/excel-programming/401650-using-textbox-cell-values.html)

Gus Chuch

using textbox for cell values
 
This is my first attempt at VB for excel. All Im trying to do is write to a
cell using a form with a textbox and a command button.
I would think you would do it something like this but its not working.
Private Sub CommandButton1_Click()
Sheet1.Cells(A, 1) = TextBox1.Value
End Sub

Any help would be appreciated
Gus Chuchanis


RB Smissaert

using textbox for cell values
 
What is A?

Try:
Sheet1.Cells(1, 1) = TextBox1.Value

RBS

"Gus Chuch" wrote in message
...
This is my first attempt at VB for excel. All Im trying to do is write to
a
cell using a form with a textbox and a command button.
I would think you would do it something like this but its not working.
Private Sub CommandButton1_Click()
Sheet1.Cells(A, 1) = TextBox1.Value
End Sub

Any help would be appreciated
Gus Chuchanis



OssieMac

using textbox for cell values
 
Hi Gus,

When you use Cells the row/column reference is back to front to Range method
and if you use the alpha column reference then enclose it in double quotes:-

Sheet1.Cells(1, "A") = TextBox1.Value

Using numeric column reference:-
Sheet1.Cells(1, 1) = TextBox1.Value
--
Regards,

OssieMac


"Gus Chuch" wrote:

This is my first attempt at VB for excel. All Im trying to do is write to a
cell using a form with a textbox and a command button.
I would think you would do it something like this but its not working.
Private Sub CommandButton1_Click()
Sheet1.Cells(A, 1) = TextBox1.Value
End Sub

Any help would be appreciated
Gus Chuchanis



All times are GMT +1. The time now is 04:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com