+ Reply to Thread
Results 1 to 6 of 6

Select Case problem

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241

    Select Case problem

    Hi,
    I am trying to make this macro work, but apparently I am nod doing it right.
    Appreciate very much your help in this regard.
    Sub CaseSelect_macro()
    
    Dim ws As Worksheet
    Dim pNbr As Range
    
    
    pNbr = InputBox("Please type in Pod# you like to load")
    
    Select Case pNbr
    
    
    Case Is = 1
    
    UserForm1.Show
    
    Set ws = Worksheets("Rack")
        ws.Cells(4, 3).Value = TextBox1.Value
        ws.Cells(5, 3).Value = TextBox2.Value
        ws.Cells(6, 3).Value = TextBox3.Value
        ws.Cells(7, 3).Value = TextBox4.Value
        ws.Cells(8, 3).Value = TextBox5.Value
       Unload Me
       
    Case Is = 2
    
    UserForm2.Show
    
    Set ws = Worksheets("Rack")
        ws.Cells(4, 6).Value = ComboBox1.Value
        ws.Cells(5, 6).Value = TextBox2.Value
        ws.Cells(6, 6).Value = TextBox3.Value
        ws.Cells(7, 6).Value = TextBox4.Value
        ws.Cells(8, 6).Value = TextBox5.Value
    Unload Me
    End Select
    
    End Sub
    Thank you
    Saziz
    Last edited by Leith Ross; 08-31-2015 at 03:55 PM. Reason: Added Code Tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Select Case problem

    Looks OK to me, how isn't it working?

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241

    Re: Select Case problem

    I apologize, here it is:
    It say "Object variable or With block variable not set"


    HTML Code: 

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select Case problem

    Hi saziz

    You have pNbr defined as range
    Dim pNbr As Range
    Probably should be
    Dim pNbr As Long
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241

    Re: Select Case problem

    Thank you Jaslake, It worked perfectly.
    Saziz

    How do I mark "solved" I forgot it has been a long time I was here..

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select Case problem

    Hi saziz


    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. [SOLVED] Select Case problem
    By Darthzo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-28-2012, 11:49 AM
  2. select case problem
    By jippii in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-11-2011, 06:05 PM
  3. select case problem
    By waltron in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2010, 05:47 AM
  4. Problem with Select Case construction
    By s80NL in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2009, 05:49 PM
  5. Long Select Case Problem
    By dsrt16 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2009, 09:58 PM
  6. [SOLVED] Having Problem with Select Case
    By haroldj@shfoodbank.org in forum Excel General
    Replies: 2
    Last Post: 07-26-2006, 06:15 PM
  7. Select case and Last Cell Problem
    By JamesBurrows in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2006, 12:55 PM
  8. Select Case Statement Problem
    By maperalia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2006, 02:10 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