Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Input box to select column

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
Befo=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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Input box to select column

hi,
something like this might work...

inp = InputBox("enter a column letter")

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

regards
FSt1

" wrote:

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
Befo=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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Input box to select column

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

wrote in message
ups.com...
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
Befo=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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with input box to select a sort up to 28 Ken Excel Discussion (Misc queries) 1 March 5th 10 07:17 PM
Input Box that allows user to select range joecrabtree Excel Programming 5 December 8th 06 04:48 PM
Select Case from Text Box Input mackerma[_2_] Excel Programming 1 October 19th 04 08:14 PM
Select Case from Text Box Input mackerma Excel Programming 0 October 15th 04 08:50 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 02:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"