Results 1 to 5 of 5

Thread: Select column based on user input

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Hello Wall31
    Welcome to ExcelFox
    I would use the standard VBA InputBox function for something very simple like you are asking for , rather than creating one,

    This is the basic coding to get you started. You would normally want to possibly consider some extra lines to check that valid input is given by the user
    ( You can give the column as a Letter, such as your P , or a number. In both cases just give the character with no quotes, )
    Alan

    Code:
    Sub SimpleInputBox()   '
    Rem 1 VBA input box function  https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/inputbox-function
    Dim Anser As String
     Let Anser = InputBox(Prompt:="Give Column number or column Letter", Title:="Select Column", Default:="A")
    Rem 2 select column
    ActiveSheet.Columns(Anser).Select
    End Sub
    Last edited by DocAElstein; 06-18-2020 at 11:42 AM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Replies: 2
    Last Post: 03-22-2014, 10:32 AM
  2. Select A Range Dynamically Based On Count Of Values
    By getlucky in forum Excel Help
    Replies: 1
    Last Post: 02-19-2014, 07:06 PM
  3. User Input requested Search box (floating of static)
    By william516 in forum Excel Help
    Replies: 0
    Last Post: 07-22-2013, 07:53 PM
  4. Insert Or Delete Columns Based On User Input
    By HDMI in forum Excel Help
    Replies: 4
    Last Post: 06-21-2013, 03:00 AM
  5. Format Cells Based on Given Input
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 10
    Last Post: 08-23-2011, 11:19 AM

Posting Permissions

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