Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Input box to select column

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
transferxxx@gmail.com - 25 Jan 2007 07:29 GMT
Sub Test()

   Dim c      As Range
   Dim rng    As Range
   Dim rng1   As Range

   Set rng = Intersect(Range("Print_Area"), Range("F:F"))
   Set rng1 = rng.Offset(1).Resize(rng.Rows.count - 1)

   For Each c In rng1
       If c.value <> c.Offset(1).value Then
           ActiveWindow.SelectedSheets.HPageBreaks.Add
Before:=c.Offset(1)
       End If
   Next
End Sub

How can I modify the above code - so that an inputbox appears allowing
me to select my column i.e replacing Range("F:F") with my selected
column

thxs
FSt1 - 25 Jan 2007 08:48 GMT
hi,
something like this might work...

inp = InputBox("enter a column letter")

Replace Range("F:F") with Columns(inp).

regards
FSt1

>  Sub Test()
>
[quoted text clipped - 18 lines]
>
> thxs
NickHK - 25 Jan 2007 09:42 GMT
If you use this, you can allow the user to select a range

Dim TheRange As Range
Const RangeOnly As Long = 8
Set TheRange=Application.Inputbox("Some prompt",,,,,,RangeOnly)
If Not TheRange Is Nothing Then
   'Continue

NickHK

> Sub Test()
>
[quoted text clipped - 18 lines]
>
> thxs
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.