select row in range vba code example
Example 1: excel vba get a range of full rows or columns
Function WSRows(ws As Worksheet, Row1&, Rows&)
Set WSRows = ws.Rows(Row1).Resize(Rows)
End Function
MsgBox WSRows(Sheet1, 11, 9).Address
v = WSRows(Sheet1, 11, 9)
Function WSCols(ws As Worksheet, Col1&, Cols&)
Set WSCols = ws.Columns(Col1).Resize(, Cols)
End Function
Example 2: excel vba first row in range
Dim rRange As Range
Dim rDuplicate As Range
Set rRange = ActiveSheet.UsedRange
lFirstRow = rRange.Row
lLastRow = rRange.Rows.Count + rRange.Row - 1
lFirstColumn = rRange.Column
lLastColumn = rRange.Columns.Count + rRange.Column - 1
Set rDuplicate = Range(Cells(lFirstRow, lFirstColumn), _
Cells(lLastRow, lLastColumn))