Posts by jbalth

    I just have no idea how to shorten this sort of stuff. The msgbox is used in place of the email code I'll be using, which is working fine. I just need to know how to put this in a loop, all the way to column J. I mean I can do it the long way, but a programmer would laugh at the method I'm using to do this...

    Re: Can someone please shorten this VBA code for me? For a userform

    All good found it!

    Each c In .Range("G:G", .Range("G" & Rows.Count).End(xlUp)) 
                If c.Value <> "" Then Me.ComboBox7.AddItem f.Value

    Type. Should be c instead of f. obviously missed the keyboard by a fraction!


    [COLOR="#FF0000"]Moderation Edit : please remember to add code tags to your VBA code[/COLOR]

    Hi There,

    I've never studied VBA, as a result I tend to do things the long way. Because there are so many combo boxes, this seems to be running slowly.

    Could someone let me know if there is a way to speed up this code? It's for a userform that's taking too long to initialise

    Thanks Heaps!

    Hey guys,

    In a lot of my macros I use userforms that have drop down boxes - In these drop down boxes the list is compiled from a range. But then, if someone chooses to manually type something different and click Submit/Ok (which then runs another macro) I'll get the subscript out of range 9 error.

    Is there a basic error handler code I can add in to stop this from happening as I use a lot of different userforms and this happens for lots of things I use

    Essentially, I would like some generic error handler that can help the user from seeing the debug screen when entering a value into the userform that doesn't exist..

    Kind Regards,


    Hi guys,

    Plenty of code out there to delete duplicate values, I know. But this always keeps the unique value. What I'm wanting to do is delete the duplicate value AND the original value. I've looked up plenty on the internet, but they don't seem to work for me for some reason.

    Could someone please help me with this - Don't necessarily worry about the ranges/sheet names, I can change all that.

    Thanks heaps! :)

    Hey guys, I'm using a macro I found on the internet to import contacts from excel to outlook. I tailored it to suit my sheet and needs and it's working well. The only thing is, if a contact is already in outlook it still creates a new contact with the same details (therefore making it a duplicate). Is there a code to ensure that excel does not import duplicate contacts using VBA?

    Here is the code

    Kind Regards,


    Re: Please shorten this code for me

    In any case, that new code you just wrote FIXES that date changing issue!!! Last question since you've been so helpful, not a big one but just curious. Whenever I load the userform, it takes a good 10-15 seconds to load and freezes excel whilst it does this, I'm assuming because it needs to load the date into all the comboboxes and being 27 of them it may be a slow process. Is there anything that could speed this up? Or just how it is? Thanks again for all your help

    Re: Please shorten this code for me

    Sorry I should have clarified in my last post - The code still works perfectly. Does exactly what I need it to do! Works perfectly.

    Its just whilst it also does what its meant to do, its adding +1 to this random date cell for some reason, I literally can see nothing that would affect this!

    Re: Please shorten this code for me

    Close. What it does it, it finds a name. Example lets say you select skywriter in the combo box. Then it will locate skywriter in range A:A and then put a +1 in the column to the right of your name. Which is why you/I have used the offset(0,1).

    That's all working fine. But for some reason, in range A theres a blank cell above all the names and to the right of that blank cell there is a date (e.g 16/03/2016). And whenever I hit submit, it will add 1 to that date - No idea whY!

    Re: Please shorten this code for me

    Can I just ask skywriter, for some reason it seems to be adding +1 to the date cell, which shouldn't be affected. I have no idea why itd be doing this!

    Basically theres a date in cell B2, that it keeps adding 1 to, I have no idea why as there is no value in the cell to the left of it and also no matching value in the comboboxes!! What the!?