Index:
1-Access a column
2-Column Selection
3-ColumnWidth
4-Hide/Unhide Column
5-Rows Selections
6-Row height
7-Hide/Unhide Row
8-Cells
1-Access a column
Writing Columns("D:D") allows you to access column D.
Private Sub CommandButton1_Click() Columns("D:D") End Sub
To access a range of columns, pass the range to the Columns collection as a string. Consider the following code:
Private Sub CommandButton1_Click() Columns("F:J") End Sub
2-Column Selection
Columns("D:D").Select
Columns("F:J").Select
3-ColumnWidth
Columns("D:D").ColumnWidth = 2.50
Columns("F:J").ColumnWidth = 4.18
4-Hide/Unhide Column
Columns("F:F").Select
Selection.EntireColumn.Hidden = True
Columns("F:F").Select
Selection.EntireColumn.Hidden = False
5-Rows Selections
Rows("8:8").Select
Rows("6:10").Select
6-Row height
Rows("16:16").RowHeight = 2.24
7-Hide/Unhide Row
Rows("6:6").Select
Selection.EntireRow.Hidden = True
8-Cells
A cell is a box at the intersection of a column and a row. The cell is the actual object that receives values or presents them to a user.The cells of a worksheet are stored in a collection called Range.
Select a unique cell
Range("F14").Select
Select multiple cell
Range("B2:D6").Select