ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change text in a cell from a command button on a Userform (https://www.excelbanter.com/excel-programming/416032-change-text-cell-command-button-userform.html)

Derek

Change text in a cell from a command button on a Userform
 
I am getting a runtime error 1004
I do realise that I am not addressing the cell correctly but cannot find out
how do do this.
I have 1 Sheet, 1 Userform and 1 module. My code (below) explains what I
want to do.
Any code to overcome this error would be greatly appreciated.

Private Sub CommandButton2_Click()

Sheets("sheet1").Range("K1").Text = "Off"

End Sub
--
Derek

TomPl

Change text in a cell from a command button on a Userform
 
Try:

Sheets("sheet1").Range("K1").Value = "Off"

"Derek" wrote:

I am getting a runtime error 1004
I do realise that I am not addressing the cell correctly but cannot find out
how do do this.
I have 1 Sheet, 1 Userform and 1 module. My code (below) explains what I
want to do.
Any code to overcome this error would be greatly appreciated.

Private Sub CommandButton2_Click()

Sheets("sheet1").Range("K1").Text = "Off"

End Sub
--
Derek


JLGWhiz

Change text in a cell from a command button on a Userform
 
The Text property is Read Only for the Range Object but is Read/Write for
everything else.

"Derek" wrote:

I am getting a runtime error 1004
I do realise that I am not addressing the cell correctly but cannot find out
how do do this.
I have 1 Sheet, 1 Userform and 1 module. My code (below) explains what I
want to do.
Any code to overcome this error would be greatly appreciated.

Private Sub CommandButton2_Click()

Sheets("sheet1").Range("K1").Text = "Off"

End Sub
--
Derek



All times are GMT +1. The time now is 01:53 PM.

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