+ Reply to Thread
Results 1 to 6 of 6

Dim statement not working?

Hybrid View

bralew Dim statement not working? 08-31-2017, 05:31 AM
BellyGas Re: Dim statement not working? 08-31-2017, 05:32 AM
bralew Re: Dim statement not working? 08-31-2017, 07:42 AM
Sintek Re: Dim statement not working? 08-31-2017, 08:18 AM
xlnitwit Re: Dim statement not working? 08-31-2017, 08:25 AM
bralew Re: Dim statement not working? 08-31-2017, 08:40 AM
  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Dim statement not working?

    Hi, I have the following code which zeros quantities and weight when a statement is selected but it doesn't seem to work and I can't see why?

    Private Sub ComboBox37_Change() 'THIS IS TO REMOVE THE WHEEL FITTINGS FROM THE PRODUCT STRUCTURE
    
    
    Dim s$
    s = ComboBox37.Text
    If s = "N/A" Or s = "SUPPLY LOOSE-NOTE39" Or s = "NOTE72-NO FITTINGS REQ'D" Then
    
    
    Me.TextBox27.Value = 0
    Me.TextBox55.Value = 0
           
                   
    End If
    
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Dim statement not working?

    
    Dim s as String

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Dim statement not working?

    Should I put that at begining?

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Dim statement not working?

    replace
    Dim s$
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Dim statement not working?

    Hi,

    There is nothing incorrect in your code. If it is not doing what you expect, the combobox text is not what you think it is- remember it must match exactly and is case sensitive.

    There is no difference between
    Dim s$
    and
    Dim s As String
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Dim statement not working?

    Your right xlnitwit, had bloody brackets, Thanks everyone for your help :-)

+ 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. IF Statement Not Quite Working
    By jimmydougle in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-18-2013, 05:52 AM
  2. Working While Statement Stops Working
    By Verbaruab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2011, 05:58 PM
  3. If statement not working
    By insanity66 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-13-2010, 04:19 PM
  4. My If statement not working
    By rlkerr in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-04-2007, 12:42 PM
  5. IF statement not working
    By TJAC in forum Excel General
    Replies: 2
    Last Post: 01-13-2006, 09:15 AM
  6. [SOLVED] If statement not working
    By excelnut1954 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-15-2005, 06:40 PM
  7. [SOLVED] For Each Statement still not working
    By Jacqui in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-02-2005, 06:20 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