View Single Post
 
Old 09-05-2016, 06:58 AM
Dave T Dave T is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: Nov 2014
Location: Australia
Posts: 66
Dave T is on a distinguished road
Default

Hello All, just thought i'd post another solution I found provided by Rick Rothstein in another forum.

Code:
Sub Rows_between_columns_A_and_K()
'http://www.mrexcel.com/forum/excel-questions/891421-restrict-range-input-box.html

  Dim Rng As Range
  
  On Error GoTo NoRangeSelected
  Set Rng = Application.InputBox("Select range spanning Columns A:K.", Type:=8)
  If Rng(1).Column <> 1 Or Rng.Columns.Count <> 11 Then
    MsgBox "You selected range """ & Rng.Address(0, 0) & """ which does not span Columns A:K!", vbCritical
  Else
    '
    ' The selected range is good, so do whatever you want with it here
    Rng.Select
    '
  End If
  Exit Sub
NoRangeSelected:
  MsgBox "No range selected!", vbCritical
End Sub
Thanks NoSparks and p45cal for taking the time to answer my question.

Regards,
Dave T
Reply With Quote