Posts by Craig Ottley

    Re: Loop through textboxes and input a referenced value

    I don't really think you can get away with writing re-usable code on this one.... You've got 70 text boxes (Which is quite a lot!), so you're going to have to program those 70 text boxes to do something??

    If you can post a sample workbook, i'll be able to take a quick look and see if you can re-factor the code somehow.


    Re: VBA create table from SQL server

    Hi Joe,

    Welcome to OzGrid. In answer to your question yes you can "simpfy" (simplify) the code.

    I've amended the thread where you found that code.

    You'll need to change this line for it to work

    ' Change this
    ' To this



    Re: SQL - Show only results where data ends with the data specified in a range

    OK that query table has major differences in the connection... Let's tackle it in small chunks.

    Can you post what gets returned when you run the following? (Making sure your Immediate Window is visible (Ctrl+G)

    Re: SQL - Show only results where data ends with the data specified in a range

    The UserID column in your Database is a text data type?? Strange....

    So what you'll want to do it start looping through the UserID column in your excel sheet. For each UserID you encounter you'll want to build a string with an apostrophe surrounding the UserID.




    Re: Help Re-factoring Code

    Hi Scotty,

    I believe the thread title you're looking for should have included Refactor... Take a look at this link to show you what I mean. When you state Simplify this code as a thread title and don't include code tags. People will most likely not answer your question.


    Re: Importing data from SQL to Excel

    Hi Ramakris,

    You can do this, but I'd lay out your "SELECT" columns slightly differently. Have you been able to make a start on this at all? You might be asking a bit too much in one go. Bite size chunks would be better...


    Re: Filtering Pivot Table In VBA

    Hi Herbds7,

    Have you tried selecting the data items you want? I don't have Excel 2010 (Yet!)... When you select the items just logically think about the order you're selecting them and try and reflect them in the code??

    Re: Calling Macros in an if statement

    Hi J.Rod,

    Instead of re-writing the wheel you'll be able to find out what the address formula does by using excels already written help... In any blank cell Press Shift+F3, Type in Address in the search for a function. Select ADDRESS and then hit Help on this function in the bottom left hand corner. You'll be able to do the same for the ROW formula.

    If you're new to excel you should try using this method, you'll probably save yourself a lot of time waiting for someone to answer a question when everything is already there. You just need to piece everything together...