Closed Thread
Results 1 to 9 of 9

help with code

  1. #1
    Registered User
    Join Date
    12-17-2018
    Location
    gloucester
    MS-Off Ver
    2016
    Posts
    17

    help with code

    hi, can anyone see anything obvious with the VBA code below. I have set up 3 work sheets all with 2 command buttons (test & retest) only sheet three with the addition of a list box. am I over thinking or am I being stupid? it just wont work or connect with command buttons....I would appreciate some help. sorry its a bit long!
    Please Login or Register  to view this content.
    [/CODE][/CODE][/CODE][/CODE][/CODE]
    Last edited by suedavies123; 12-18-2018 at 06:37 AM.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: arghhh! please take a look and help if poss.

    Yes, it does not have code tags. Click the 'Edit Post' button, then use the mouse pointer to higlight all of your code. Then click the pound symbol (#) in the tool bar of the edit pane. Code tags will then be put on you code and it will hold its format when you click the 'Post Reply' button. In the meantime, I will be looking at the code you posted to see if I can help.

    If IsEmpty(Range("D5")) Then
    This is an incorrect use of the IsEmpty function and can result is erroneous results. Use this syntax instead:
    Please Login or Register  to view this content.
    The IsEmpty function in VBA is designed to test if a variable has been initialized. Its properties do not include the value of a cell, so it can return a false result if used to check whether a cell is blank or not.

    In VBA3
    If fib.ListBox <> -1 Then
    I am not sure what the fib is but the syntax appears to be the problem. Let's say that the listbox name is List Box 1 and it is from the Form Controls tool box. The syntax would be like this
    Please Login or Register  to view this content.
    . If fib is not a global variable, it needs to be declared within the macro.

    these are a couple of things I noticed.
    Last edited by JLGWhiz; 12-17-2018 at 05:21 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    12-17-2018
    Location
    gloucester
    MS-Off Ver
    2016
    Posts
    17

    Re: arghhh! please take a look and help if poss.

    Thank you, I will change and see if it works and will let you know. I'm wondering if it's because of that why it wont connect.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: arghhh! please take a look and help if poss.

    1. Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 6)
    2. Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 6)
    Ben Van Johnson

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: help with code

    If you do not use the correct syntax for the name of the control, it vba will either throw an error or ignore it. One way to see what is happening is to step through the code useing the F8 funcion key. To do that, open the vb editor pane (Alt + F11) to your code, click anywhere in the body of the code then press F8 key. The title line of the code should highlight in yellow. Then as you press F8, the highlight moves to the next line of code with the previous line being excuted. You can diminishe the size of the editor window so it overlays the worksheet window and see what is happening as the code executes. If the highlight changes on the code but the worksheet does not reflect that change then you know where to look for the cause of the problem.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,833

    Re: help with code

    Not only is the thread title (still) not suitable, you have cross-posted here: https://www.mrexcel.com/forum/excel-...-vba-code.html

    You are a new member and will be given the benefit of the doubt, therefore, but please make sure you read and adhere to our forum rules in future: https://www.excelforum.com/forum-rul...rum-rules.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    12-17-2018
    Location
    gloucester
    MS-Off Ver
    2016
    Posts
    17

    Re: help with code

    please feel free to remove me. I thought you could come to these sites for help. I received an email saying I wouldn't get any responses until i had done something that I couldn't work out how to do, so I went somewhere else for help and have now had an email from them saying I wont receive and responses because I have cross posted.... so please remove me.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: help with code

    @suedavies123
    It is a simple case of, please read the forum rules and abide by them and we will be more than happy to assist you. It is apparent from your post that you have ignored our requests to read and abide by our rules. Help is available once you do so.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  9. #9
    Registered User
    Join Date
    12-17-2018
    Location
    gloucester
    MS-Off Ver
    2016
    Posts
    17

    Re: help with code

    So I keep being told. God forbid a new member makes a mistake. Please tell me how to remove my account.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Nested ifs with date lookup, arghhh help!
    By lyyynnnchy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-21-2016, 08:20 PM
  2. Trying to learn as much as poss about Excel - long way to go!
    By secretary in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 05-21-2012, 03:31 AM
  3. Excel 2007 : Nested IF, AND IF, ISNA IF.. Arghhh
    By myvlturbo in forum Excel General
    Replies: 3
    Last Post: 06-26-2010, 12:00 AM
  4. Formula - poss countif and sum
    By Steve_BC in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-06-2008, 05:16 PM
  5. Help with Poss. Do Until Formula
    By iancallaghan87 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-04-2006, 03:48 PM
  6. Please help. poss VBA
    By Clash in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2006, 09:31 AM
  7. Send from excel to webpage...is it poss?
    By Ron in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2005, 04:05 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