+ Reply to Thread
Results 1 to 7 of 7

Capture Col number

  1. #1
    davegb
    Guest

    Capture Col number

    How would I capture the column number after I used this find function
    to find a cell with "Time" in it?

    Cells.find(What:="Time", After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    _
    MatchCase:=False).Activate

    Thanks for the help!


  2. #2
    Chip Pearson
    Guest

    Re: Capture Col number

    Dave,

    Try something like

    Dim FoundCell As Range
    Set FoundCell = Cells.Find(...)
    If Not FoundCell Is Nothing
    FoundCell.Activate
    MsgBox "Found in column: " & FoundCell.Column
    Else
    ' not found
    End If


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "davegb" <davegb@safebrowse.com> wrote in message
    news:1117224280.524424.207970@f14g2000cwb.googlegroups.com...
    > How would I capture the column number after I used this find
    > function
    > to find a cell with "Time" in it?
    >
    > Cells.find(What:="Time", After:=ActiveCell, LookIn:=xlFormulas,
    > _
    > LookAt:=xlPart, SearchOrder:=xlByRows,
    > SearchDirection:=xlNext,
    > _
    > MatchCase:=False).Activate
    >
    > Thanks for the help!
    >




  3. #3
    davegb
    Guest

    Re: Capture Col number

    Thanks for the help, Chip. It's giving a compile error on
    If Not FoundCell is Nothing
    Any ideas on what would cause that?

    Chip Pearson wrote:
    > Dave,
    >
    > Try something like
    >
    > Dim FoundCell As Range
    > Set FoundCell = Cells.Find(...)
    > If Not FoundCell Is Nothing
    > FoundCell.Activate
    > MsgBox "Found in column: " & FoundCell.Column
    > Else
    > ' not found
    > End If
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    > "davegb" <davegb@safebrowse.com> wrote in message
    > news:1117224280.524424.207970@f14g2000cwb.googlegroups.com...
    > > How would I capture the column number after I used this find
    > > function
    > > to find a cell with "Time" in it?
    > >
    > > Cells.find(What:="Time", After:=ActiveCell, LookIn:=xlFormulas,
    > > _
    > > LookAt:=xlPart, SearchOrder:=xlByRows,
    > > SearchDirection:=xlNext,
    > > _
    > > MatchCase:=False).Activate
    > >
    > > Thanks for the help!
    > >



  4. #4
    davegb
    Guest

    Re: Capture Col number

    I found something else. How would I find a cell with ONLY the word
    "Time", not say, "Overtime"?


  5. #5
    Norman Jones
    Guest

    Re: Capture Col number

    Hi Davegb,

    Replace

    > If Not FoundCell is Nothing


    with

    If Not FoundCell is Nothing Then

    ---
    Regards,
    Norman



    "davegb" <davegb@safebrowse.com> wrote in message
    news:1117227650.590737.259790@z14g2000cwz.googlegroups.com...
    > Thanks for the help, Chip. It's giving a compile error on
    > If Not FoundCell is Nothing
    > Any ideas on what would cause that?
    >
    > Chip Pearson wrote:
    >> Dave,
    >>
    >> Try something like
    >>
    >> Dim FoundCell As Range
    >> Set FoundCell = Cells.Find(...)
    >> If Not FoundCell Is Nothing
    >> FoundCell.Activate
    >> MsgBox "Found in column: " & FoundCell.Column
    >> Else
    >> ' not found
    >> End If
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >> "davegb" <davegb@safebrowse.com> wrote in message
    >> news:1117224280.524424.207970@f14g2000cwb.googlegroups.com...
    >> > How would I capture the column number after I used this find
    >> > function
    >> > to find a cell with "Time" in it?
    >> >
    >> > Cells.find(What:="Time", After:=ActiveCell, LookIn:=xlFormulas,
    >> > _
    >> > LookAt:=xlPart, SearchOrder:=xlByRows,
    >> > SearchDirection:=xlNext,
    >> > _
    >> > MatchCase:=False).Activate
    >> >
    >> > Thanks for the help!
    >> >

    >




  6. #6
    Chip Pearson
    Guest

    Re: Capture Col number

    Dave,

    I forgot the 'Then' at the end of the If statement.

    If Not FoundCell Is Nothing Then


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "davegb" <davegb@safebrowse.com> wrote in message
    news:1117227650.590737.259790@z14g2000cwz.googlegroups.com...
    > Thanks for the help, Chip. It's giving a compile error on
    > If Not FoundCell is Nothing
    > Any ideas on what would cause that?
    >
    > Chip Pearson wrote:
    >> Dave,
    >>
    >> Try something like
    >>
    >> Dim FoundCell As Range
    >> Set FoundCell = Cells.Find(...)
    >> If Not FoundCell Is Nothing
    >> FoundCell.Activate
    >> MsgBox "Found in column: " & FoundCell.Column
    >> Else
    >> ' not found
    >> End If
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >> "davegb" <davegb@safebrowse.com> wrote in message
    >> news:1117224280.524424.207970@f14g2000cwb.googlegroups.com...
    >> > How would I capture the column number after I used this find
    >> > function
    >> > to find a cell with "Time" in it?
    >> >
    >> > Cells.find(What:="Time", After:=ActiveCell,
    >> > LookIn:=xlFormulas,
    >> > _
    >> > LookAt:=xlPart, SearchOrder:=xlByRows,
    >> > SearchDirection:=xlNext,
    >> > _
    >> > MatchCase:=False).Activate
    >> >
    >> > Thanks for the help!
    >> >

    >




  7. #7
    davegb
    Guest

    Re: Capture Col number

    Thanks, Chip. Got it working.

    Chip Pearson wrote:
    > Dave,
    >
    > I forgot the 'Then' at the end of the If statement.
    >
    > If Not FoundCell Is Nothing Then
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    >
    > "davegb" <davegb@safebrowse.com> wrote in message
    > news:1117227650.590737.259790@z14g2000cwz.googlegroups.com...
    > > Thanks for the help, Chip. It's giving a compile error on
    > > If Not FoundCell is Nothing
    > > Any ideas on what would cause that?
    > >
    > > Chip Pearson wrote:
    > >> Dave,
    > >>
    > >> Try something like
    > >>
    > >> Dim FoundCell As Range
    > >> Set FoundCell = Cells.Find(...)
    > >> If Not FoundCell Is Nothing
    > >> FoundCell.Activate
    > >> MsgBox "Found in column: " & FoundCell.Column
    > >> Else
    > >> ' not found
    > >> End If
    > >>
    > >>
    > >> --
    > >> Cordially,
    > >> Chip Pearson
    > >> Microsoft MVP - Excel
    > >> Pearson Software Consulting, LLC
    > >> www.cpearson.com
    > >>
    > >>
    > >> "davegb" <davegb@safebrowse.com> wrote in message
    > >> news:1117224280.524424.207970@f14g2000cwb.googlegroups.com...
    > >> > How would I capture the column number after I used this find
    > >> > function
    > >> > to find a cell with "Time" in it?
    > >> >
    > >> > Cells.find(What:="Time", After:=ActiveCell,
    > >> > LookIn:=xlFormulas,
    > >> > _
    > >> > LookAt:=xlPart, SearchOrder:=xlByRows,
    > >> > SearchDirection:=xlNext,
    > >> > _
    > >> > MatchCase:=False).Activate
    > >> >
    > >> > Thanks for the help!
    > >> >

    > >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1