Dynamic range selection and uses of Cells
A cell property occures the number for row and column and it is refered to worksheet’s cell, when a card or manually passes the value to cell property in VBA scripting it selects the single cell on worksheet.
Cells arguments are – Row_index and Column Index
Row_index = single no. of row to be selected
Col_index = single no. of col to be selected
Example : cells(1,1).select ‘it is referenced for single cell by VBA Code and selection of cell on worksheet is “A1”.
If starting point is not specified, it considers whole worksheets. also a starting point of selection can be defined from certain point in the worksheet.
3 subs just copy and understand the logic
‘======= if starting range is not specified so cells(1,1) = “a1″ ======
Cells(1, 1).Select ‘”a1” will be activated
‘ specified starting range
Range(“b5”).Cells(1, 1).Select ‘ start point
Demonstrated through loop – increment 1 row and 1 column
Sub Increment_trail ()
Dim x as long
For x = 1 to 10
Cells(x,x).value = x & “CellSelection”
Start from certain range – copy below code and try
Dim x As Long
For x = 1 To 10
Range(“b5”).Cells(x, x).Value = x * 10
Range(“b5”).Cells(0, x).Value = x & “Header”
Range(“b5”).Cells(x, 0).Value = x