Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Oscar Montgomery   on Nov 17 In MS Office Category.

  
Question Answered By: Lena Moore   on Nov 17

You can refer to any sheet  - either by name or by index. Look at the
WorkSheets and sheets  collections (I think they both do the same thing).

E.g.

Option Explicit

Private Sub CommandButton1_Click()
Worksheets(1).Range("a1").Value = 1
Worksheets(2).Range("a1").Value = 2
Sheets(1).Range("a2").Value = 1
Sheets(2).Range("a2").Value = 2
Sheets("Sheet1").Range("a3").Value = 1
Sheets("Sheet2").Range("a3").Value = 2
End Sub

Share: 

 
 
Didn't find what you were looking for? Find more on Control toolbox button Or get search suggestion and latest updates.


Tagged: