+ Reply to Thread
Results 1 to 3 of 3

Part of VBA code won't execute as I planned it to do - Probably a simple mistake !!

  1. #1
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Part of VBA code won't execute as I planned it to do - Probably a simple mistake !!

    Hi I am a bit stumped and cannot see where I am going wrong. The detail is as follows......

    The code below works fine apart for the 5th line in the code If Range("c21") = 0 Then...

    In the worksheet Range C21 value is currently 2 but the macro just exits when I run the full routine and it gets to line 5 when I need it proceed to the printing stage.

    Hoping someone can spot my error????

    Please Login or Register  to view this content.
    Last edited by hans302; 03-16-2018 at 12:51 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Part of VBA code won't execute as I planned it to do - Probably a simple mistake !!

    It helps to indent the code to see the nested hierarchy.

    Is your Value in P29 > 0 ? If not, the code exits.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Re: Part of VBA code won't execute as I planned it to do - Probably a simple mistake !!

    That's great - I've added another line of code that picks up if P29 = 0 then it will jump over 5 lines of code using another GOTO function.

    Seems to work OK now

    Thanks again.

+ 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] New to VBA - Where's my mistake with this small bit of code?
    By OpieWinston in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2017, 10:25 AM
  2. [SOLVED] Mistake in code
    By jj4jj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2016, 11:11 AM
  3. reduce part code and simple it.
    By ninhmoon in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-10-2015, 07:03 PM
  4. code to execute a keyboard shortcut or to execute a toolbar button
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2015, 12:16 PM
  5. Code not working as planned
    By sulavsingh6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2009, 03:53 PM
  6. Where Is My Code Mistake For Listbox ?
    By blackvba in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2008, 02:29 AM
  7. Code mistake
    By Mirko Barkovic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2005, 10:00 AM

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