Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    vancouver, BC, Br. Columbia
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Go to user-selected cell (Excel 97)

    I want the user to enter the cell where my macro should start. The following code doesn't work.

    strAddress = InputBox("Enter address where macro should start")
    Range(" & straddress & ").Select

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Go to user-selected cell (Excel 97)

    Try using:

    Range(straddress).Select

    Make sure that you somehow validate that it is in A1 format
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    vancouver, BC, Br. Columbia
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Go to user-selected cell (Excel 97)

    Wow! Thanks Bryan - works like a beauty!

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Go to user-selected cell (Excel 97)

    Consider using this:

    Sub selectACell()
    Dim oCell As Range
    On Error Resume Next
    Set oCell = Application.InputBox("Select a cell please", , , , , , , 8)
    If oCell Is Nothing Then
    MsgBox "Cancelled!"
    Else
    MsgBox oCell.Address & " contains " & oCell.Value
    End If
    End Sub
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    vancouver, BC, Br. Columbia
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Go to user-selected cell (Excel 97)

    Jan - This is even better because input is constrained to a valid range. Love it! so, there must be TWO input boxes: application.inputbox, and just plain Inputbox. I guess the former is an Excel object and the latter is a VBA object.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Go to user-selected cell (Excel 97)

    Correct, there are two. A VBA function and a method (belonging to Excel)
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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