Read other data
Author: KLYan Source:
OfficeFans
Several methods of how to read other worksheets, read this worksheet: Add the worksheet name Sheet4 before being read. Public Sub Writes () 1 - 2 Method, the simplest in reading "[]" plus the read worksheet name Sheet4.1 [A1] = Sheet4. [A1] 'Take Sheet4 A1 cells Data reads A1 cells. 2 [A2: A4] = SHEET4. [B1] '' Put the Shee4 works table cell B1 data, reads to the A2: A4 cell. 3 - 4 Method, before the read worksheet RANGE ("") before adding the read worksheet name Sheet4.3 Range ("B1") = Sheet4.Range ("B1") '' Workfill the Shee4 works table cell B1 data to read the B1 cell. 4 RANGE ("C1: C3") = Sheet4.Range ("C1") 'Putting the Shee4 works table cell C1 data, reads C1: C3 cells. 5 - 6 Method, in the read worksheet Cells (Row, Column), Cells before adding the table name Sheet4.5 Cells (1, 4) = sheet4.cells (1, 4) ' Shee4 worksheet cell D1 data, reads D1 cells. 6 Range (Cells (1, 5), Cells (5, 5)) = Sheet4.cells (1, 5) 'Put the Shee4 works table cell E1 data, reads the E1: E 5 cell. End Sub
You click any cell, press the Selection button, then the selected cell will be entered by the SHEE4 workfinder F1 data. Public Sub Selection1 () Selection.Value = Sheet4. [F1] 'Putting the Shee4 works table cell F1 data, reads any cells you click. End Sub
Attachment: vbalesson2