assign value to cell in another worksheet

  • Thread starter Thread starter tango
  • Start date Start date
T

tango

dear all,
when i click the button the word sample will appear in a cell in other
worksheet. below is lacking the info. Pls help


Private Sub CommandButton_Click()

Range("D2").Value = "Sample"

End Sub
 
In your code the word sample is placed in the active sheet.

To place the word sample in a specafic sheet use

Sheets("sheet1").range("d2").value = "sample"

or

workSheets("sheet1").range("d2").value = "sample"

You can also specify a workbook by

workbook("book1").Sheets("sheet1").range("d2").value = "sample
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top