View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Command button code

Hi Gary,

Try something like:

'=============
Private Sub CommandButton1_Click()
Dim SH As Worksheet
Dim Rng As Range
Const sStr As String = "ABC" '<<==== CHANGE

Set SH = ThisWorkbook.Sheets("Sheet2") '<<==== CHANGE
Set Rng = SH.Range("A1") '<<==== CHANGE
Rng.Value = sStr
End Sub
'<<=============


---
Regards,
Norman


"Gary" wrote in message
oups.com...
Hi all,

I have created a command button on a worksheet in an Excel 2003
workbook. I just need to assign some code to this button so that when
clicked, it will simply enter text into a cell in another worksheet in
the same workbook.

Sounds very easy to me, but I've not been able to figure it out yet,
or see any examples.

Can someone help me out please?

Thanks a lot.

Gary.