Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2003
    Location
    Hershey, Pennsylvania, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    columns command (2000)

    My boss wants to select multiple columns using indexes, not alphabetic indexes, but numeric indexes.

    I have no clue what he's talking about -- does this make sense to anybody out there?

    Thanks!

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: columns command (2000)

    If he just wants to see column numbers instead of letters, then he can use the menu Tools | Options... | General tab. If the R1C1 reference style is checked, then the column headers are numbers instead of letters (but the formulas will look strange). If he wants a macro, he can use this:
    <pre>Option Explicit

    Sub selectColumns()
    Dim s As String, lo As Integer, hi As Integer
    Do
    s = InputBox(Prompt:="Enter first and last column number, " & vbCr & _
    "separated by a comma")
    If s = "" Then Exit Sub ' Pressed cancel
    On Error GoTo badColumns
    lo = Split(s, ",")(0)
    hi = Split(s, ",")(1)
    Range(Cells(1, lo), Cells(1, hi)).EntireColumn.Select
    Exit Sub
    badColumns:
    MsgBox "You must enter two valid column numbers", vbExclamation
    Loop
    End Sub</pre>


    If this is not what he wants, then you will have to give us more information. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    Lounger
    Join Date
    Mar 2003
    Location
    Hershey, Pennsylvania, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: columns command (2000)

    He said "Hmmm -- can I keep this? I know what I need to do now."

    Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •