Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 09-05-2016, 06:58 AM
Dave T Dave T is offline InputBox selects rows Windows 7 64bit InputBox selects rows Office 2007
Advanced Beginner
InputBox selects rows
 
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
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
InputBox selects rows MS Word 2010 Table Selector Selects Header On One Page and Rows On Next Page scptech Word Tables 4 01-11-2016 02:55 PM
VBA Macro for word with Inputbox ryanch69 Word VBA 2 12-03-2015 07:45 AM
InputBox selects rows Idiot Proof Entry with InputBox arpirnat Word VBA 1 04-27-2015 10:03 PM
Is there a way to change how Excel auto selects where it pulls data? PStark Excel 0 12-30-2014 09:28 AM
InputBox selects rows Cannot select single characters. Word selects paragraphs or parts of sentences. TMinnich Word 2 10-25-2013 09:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft