+ Reply to Thread
Results 1 to 9 of 9

How to return address of the column or cell I select, not just return the value?

Hybrid View

qzqzjcjp How to return address of the... 08-18-2014, 12:01 PM
Solus Rankin Re: How to return address of... 08-18-2014, 12:08 PM
qzqzjcjp Re: How to return address of... 08-18-2014, 01:24 PM
Solus Rankin Re: How to return address of... 08-18-2014, 01:33 PM
qzqzjcjp Re: How to return address of... 08-18-2014, 01:39 PM
Solus Rankin Re: How to return address of... 08-18-2014, 01:50 PM
qzqzjcjp Re: How to return address of... 08-18-2014, 02:17 PM
Solus Rankin Re: How to return address of... 08-18-2014, 02:22 PM
qzqzjcjp Re: How to return address of... 08-18-2014, 04:57 PM
  1. #1
    Registered User
    Join Date
    08-07-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    95

    How to return address of the column or cell I select, not just return the value?

    How to return address of the column or cell I selected from Application.Inputbox, not just return the value?
    Categorycolumn = Application.InputBox("Which column do you want select?", "Column")
        
          
            MsgBox Categorycolumn
    Thanks Guys

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to return address of the column or cell I select, not just return the value?

    Dim categorycolumn As Long
    
    
    categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column
    
    MsgBox categorycolumn
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    08-07-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    95

    Re: How to return address of the column or cell I select, not just return the value?

    Thank you so much. However, what if I want to add more status as shown below? When I pressed Cancel or Ok without selecting, error prompt always shows up.
    a:      Categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column
        
               Select Case Categorycolumn
            Case False
                Exit Sub
            Case ""
                MsgBox "You have to select!"
                GoTo a
            Case Else
            MsgBox Categorycolumn
            End Select

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to return address of the column or cell I select, not just return the value?

    What did you declare Categorycolumn as? Please include the entire code.

  5. #5
    Registered User
    Join Date
    08-07-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    95

    Re: How to return address of the column or cell I select, not just return the value?

    sorry
    Dim Categorycolumn As Integer
    a:      Categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column
        
               Select Case Categorycolumn
            Case False
                Exit Sub
            Case ""
                MsgBox "You have to select!"
                GoTo a
            Case Else
            MsgBox Categorycolumn
            End Select

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to return address of the column or cell I select, not just return the value?

    If you click okay with a blank inputbox its going to tell you your input is incorrect and give you the option to correct (native function of inputbox).

    Your only options will be input a range and click okay or hit cancel and exit.

    Dim categorycolumn As Long
    
    On Error Resume Next
    categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Column
    On Error GoTo 0
    
    If categorycolumn > 0 Then
        MsgBox categorycolumn
    End If


    e/ I just noticed the title says return the ADDRESS of the column or cell you selected and not the column number. Are you looking for the address of the selected cell (i.e. C5)?

    Sorry for not paying attention.
    Last edited by Solus Rankin; 08-18-2014 at 02:02 PM.

  7. #7
    Registered User
    Join Date
    08-07-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    95

    Re: How to return address of the column or cell I select, not just return the value?

    It's ok. Actually, you already solved my next step. The address I was looking for actually is for returning the Column number.
    But, could you please tell me how to return address as well? I appreciate for your helping.

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to return address of the column or cell I select, not just return the value?

    Dim categorycolumn As String
    
    On Error Resume Next
    categorycolumn = Application.InputBox("Which column do you want select?", "Column", Type:=8).Address(False, False)
    On Error GoTo 0
    
    If categorycolumn <> "" Then
        MsgBox categorycolumn
    End If

  9. #9
    Registered User
    Join Date
    08-07-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    95

    Re: How to return address of the column or cell I select, not just return the value?

    great! Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. return cell address of a max
    By sandsoppa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-15-2012, 04:18 PM
  2. Search...Return...give info based on the return address
    By deek1004 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-11-2012, 03:36 PM
  3. Replies: 3
    Last Post: 07-27-2011, 02:29 PM
  4. [SOLVED] Is is possible to have a macro select a cell and return the address for use as a variable?
    By JasonK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2006, 09:15 AM
  5. [SOLVED] return a cell address?
    By green fox in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2005, 01:30 PM

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