Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
Public Function GetRangeFromInputBox() As Range
 Dim IPBoxRng As Range
 Set IPBoxRng = Application.InputBox("Select a range of Sample ID's", "Obtain Range Object", Type:=8)

 Dim IPBoxRngCol As Integer, IPBoxRngfRow As Integer, IPBoxRnglRow As Integer
 IPBoxRngCol = IPBoxRng.Column
 IPBoxRngfRow = IPBoxRng.Row
 IPBoxRnglRow = lRowOfCol(ColNum:=IPBoxRngCol)
 Set GetRangeFromInputBox = Range(Cells(IPBoxRngfRow, IPBoxRngCol), Cells(IPBoxRnglRow, IPBoxRngCol))
End Function

See "Find Last" for lRowOFCol Function

Dim urng As Range
Dim rng As Range
Set urng = ws.Application.InputBox("Select a range", "Obtain Range Object", Type:=8)
Set rng = ws.Range(Col_Letter(urng.Column) & "1:" & Col_Letter(urng.Column) & Cells(Rows.Count, urng.Column).End(xlUp).Row)
  • No labels