Consulting

Page 1 of 3 1 2 3 LastLast
Results 1 to 20 of 60

Thread: Excel VBA Programmer Interview

  1. #1

    Question Excel VBA Programmer Interview

    Hello guys,

    I have been around this forum for a while; also I have studied on my own. So its safe to say I am an ok Excel programmer. I have been taking some programming classes at school and I am on my way to get my Bachelors in Computer Science, application development (I have not taken the major courses yet)

    So a few days ago I applied for a job online and they want to hire me. I am extremely scared. This would be my first job as an Excel programmer.

    For the professionals out there, what do they usually ask in this kind of interviews?

    How much do you need to know say I am able to do this job? I mean I can do most of the things, but is it ok if I look things up online or use a reference book; mostly I know where to look, its not like I am looking for something totally blind.

    Is using Macro recording to get some method and properties considered cheating? what if you supervisors sees you going online to research something?

    Thanks a lot for the help
    Feedback is the best way for me to learn


    Follow the Armies

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    If they know your history, then they know that you are a noob.

    What you are not is an OK Excel /VBA programmer. You are a noob. Own that fact. Make yourself say it in the mirror every day before work. Accept that you will make mistakes. Say that in the mirror too.

    After about 1000 hours programming, you can graduate to Newbie status.



    I have maybe 3000 hours in VBA for Excel. On an apprentice scale of 1 to 7, that only makes me about a a Level 4 Apprentice Excel Progmammer and still a noob at all other Office programs. However those 3000 hours will carry over as soon as I accumulate another 1000 hours in all the other Office applications. That would make me a Level 4 Apprentice MS Office programmer. Note that that does not make me qualified to design worksheets, 'cuz "I know nuttink" about Excel Worksheet Functions.

    Studies have shown that it takes about 10,000 hours of practice, doing, and study to become an expert in any field.





    The Employer (should) know that you are still a noob and take that into consideration, by putting you into a team of more experienced staff.

    When you go to work always remember the noob golden rule: "If you be talkin', you ain't learnin'!"

    Show up on time. Respect your elders,even when they are wrong... Make that "Especially when they're wrong." Be willing to work at things you hate. spend at least 10 hrs a week of your own time learning. (those hours add to your 10,000 needed to be an expert.) Just those simple things will make you a very valuable employee.

    If you do find that you are Solo on the job, dig in. Don't ever give up. And spend those 10 hrs a week of personal time working the job's problems. They still add to your 10,000.

    Good luck and
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Thanks a lot for the advise Samt.

    I think it will be hard to tell the employer I am a noob. I was wondering what would be a good way to put it. " I am still learning", "there are a lot of things I still don't know" ... and how to make it better with things like "If I don't know I can research about it" or "I could use a reference book"

    I don't know all of the sudden I feel like I am not qualified for the job lol. Maybe I need to mature more.

    I think it will be a solo job, which already makes it harder. Although I am supposed to have an interview with IT personnel.

    Is there a way to inquire about what they expect?
    For example : Its not the same if they want me to design a report for a few employees or if they want me to create a big addin to be implemented in Excel with ribbon buttons and all (I don't know a lot about that)

    As per practice I am always looking for things I can VBA automate in my office, first to make my job easier, second to learn more and sharpen my abilities.

    Thanks a lot for the help. It's good indeed not only for this job but for life in general as I forge my path as a programmer.
    Feedback is the best way for me to learn


    Follow the Armies

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Does the employer have your resume or at least work and education history? Then he already know that you are a noob. That menas that he already thinks that a noob is what he needs. And That means you can do the job.

    Relax. So what if you don't land the very first offering that came along?

    The only thing you must do to guarantee that you DON"T get the job is to tell a lie. All interviewers have "The Nose."

    They expect someone who has studied and done the things you said that you have.

    Don't worry about it. If you find that you don't know exactly what to do, find out How To. Google is your friend. We are your friend.

    All you need is a little help from your friends. .

    We will you when you need it. We will when you're down, and we will when you get that raise. Then we will make you buy the


    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    Yes they have my resume.

    And yeah its very clear this would be my first purely programmer Jobs. All I have done is make my current admin job better using Excel VBA. Of course I routed it in a way that shows me as a programmer and not an admin.

    Instead of "Invoice customers making sure prices are correct" , " Created a spread sheet to import invoices and check for correct prices and find errors"

    Thanks a lot for the support and the extended hand. Its really appreciated. I will make sure to come back and keep you guys updated on the outcomes.
    Feedback is the best way for me to learn


    Follow the Armies

  6. #6
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Well good luck! I always tell people I'm still learning - because I am. Generally I find when explaining to people what I can/not do in technologies is to keep it broad. Tell them I can work with cells/worksheets/workbooks, tables, PivotTables, create add-ins, modify command bars & the ribbon, charting/visualization, interactivity in other Office applications, etc. Someone conducting the interview will most likely have some goals they're looking to achieve, so they will drill down specific questions.

    Things you should know:
    • You'll never know it all (nobody does)
    • You'll learn as long as you want to
    • You can never remember everything (everyone needs resources)
    • Most people who think they're "good" in an app, aren't
    • Always be modest
    • Always be honest
    • Always over-perform
    • Always over-deliver
    • Show respect to others
    • Always demand respect from others
    • Always say please and thank you
    • Always smile - it's contagious


    In any case, good luck to you!

    EDIT: Forgot to answer those last two questions as well.

    "Is using Macro recording to get some method and properties considered cheating?"
    I sure as hell hope not, otherwise consider me busted! Sometimes it's the easiest way to get a syntax or object method. It's not cheating at all.

    "What if you supervisors sees you going online to research something?"
    Doesn't seem relevant to me. I go online all the time. Usually it's for finding a syntax, checking an objects properties, syntax limitations, etc. Perfectly ok.

  7. #7
    Thanks a lot Zack. I have have been expecting your insights on this (as well as other member's) After a while browsing the forum you learn to trust certain people .

    Its awesome to you decided to stop and comment.

    I have a phone interview on Monday.
    Feedback is the best way for me to learn


    Follow the Armies

  8. #8
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    You're very welcome! I'm not the best by any means, and I'm sometimes cantankerous, so take it for what it's worth.

    Something I should have added to the list is confidence. Be confident in your abilities as well as your inabilities. Every once in a while I get asked what makes me an expert. It's not like there's a degree for Excel. I usually tell people, "because I said so." After I get a funny look I tell them I've been doing this for quite a few years, helped thousands of people, received some awards, etc.

    Another good piece of advice I got from someone a while ago is accept failure, it will define your success.

  9. #9
    lol Thanks for the extra tips

    Yes, for a split of a second I thought I was not prepared for this. I almost did not click the "Apply here" link. But I am glad I did; and no matter what the actual work outcomes are...I have learned a lot from all of you guys. Its something I will always have with me.

    Thanks to you All
    Feedback is the best way for me to learn


    Follow the Armies

  10. #10
    OK so I had a phone interview today.

    I think it went well. I was asked how much of Excel I know and how much VBA I know. I was asked about functions and SQL to the second one I answered that I did not know.

    Apparently they had people in the company that know some VBA and they have been working half time as admins and other half as VBA programmers. They are looking for someone that would take ownership over the programming part. I asked about code structure and documentation and and he replied that the only documented code was pretty much his. (This was the funny moment of the interview, which loosened tensions) He told that the worst codes where done by people who just recorded the macros. (This is good because formatting is a fairly easy part of VBA)

    He also asked about Virgin Control and I said I did not know and he said that if anything its something to talk about.

    He scheduled a test for tomorrow. (which is a good sign according to the staffing agency) I asked him about the test and he told me not to worry that its a VBA test not one of those Excel where "you have to know under that tab is what command in condensed ribbon" he confessed that if he had to do one of those he would fail. (another round of laughs)

    I have one hour tomorrow at 2:00 pm to complete. What kind of questions are asked in these tests? Has anyone done one like that? Any must-know thing?

    Thanks a lot
    Feedback is the best way for me to learn


    Follow the Armies

  11. #11
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Glad to hear it went well!

    I would assume they would ask more specific questions tomorrow, probably based around processes they've developed or are working with currently. Assuming they're working with SQL back end(s?) or making connections, perhaps they're doing this via VBA and manipulating/creating queries to return data. There are a dozen different ways to do it, so can't really say one way or the other. Perhaps they'll ask you to debug some code? Maybe write some? Or perhaps just ask you about how you would do things?

  12. #12
    Thanks Zack I will post tomorrow. In the meantime I will google my question with some luck something will come up.
    Feedback is the best way for me to learn


    Follow the Armies

  13. #13
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    It sounds like the perfect job for a beginner wanting to become a programmer: Clean up and document a bunch of Macros is an excellent way to learn VBA and see the standard approach to a wide variety of problems.

    You might think about getting some 8x5 cards and make notes of each macro name, it's input and output names, and what it does. It won't be long before you start to perceive some patterns in the way all the Macros work together. I would sugest that you buy an artist's sketch book (24"x36") and as soon as you get home, sketch out those patterns you think you see. Eventually they will all come together into something you can call a system.

    Then... you can start Refactoring them into a real program.

    You should substitute that method that helps you see the over all picture for my artist's sketchbook.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  14. #14
    Thanks for the advise SamT
    Feedback is the best way for me to learn


    Follow the Armies

  15. #15

    Post

    Hello guys,

    OK I had my test today. I think it went well.

    These are some of the questions:
    1. Open a .csv File and convert the contents to columns with a pipe delimiter.
    This was my answer to this question. By the way I sort of freaked out. I did not know I could not import .csv with workbooks.opentext lol

    Sub ImportData()
    
    Dim wbk As Workbook
    
    Set wbk = Workbooks.Open(Filename:="C:\Users\Alfredo\Desktop\data.csv")
    
    Range("A1").CurrentRegion.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, OtherChar:="|"
    
    End Sub

    2. Explain the difference between Class, Module, Subroutine and Function.

    • A class is used to create custom objects
    • A module is a container to store the subroutines
    • A subroutine is a series of cod that execute a specific action.
    • A function is a specific type of subroutine that returns a value


    3. Whats a named range and how to reference it in VBA
    A named range is a name that can be given to a range in excel and it can later on be used to reference a group of cells and used in calculations.
    In VBA you reference a named range as
    Range(“MyNamedRange”)
    Or
    [MyNamedRange]
    4. A workbook contains just one sheet named "Sheet1". Give three possible VBA code examples on how to Debug.Print the name of that sheet.
    Sheets(1).name
    Sheets(“Sheet1”).name
    Sheets(thisworkbook.sheets.count).name
    Sheet1.name
    5. What would be the debug output of calling the TestPrintOutput subroutine
    The output would be “John” the sub “TestPrintOutput” passes the variable name to the other sub “SayHello” and returns the new variable the name.There might be an error in this code if the desired result is “”Hello, John”

    Public Sub TestPrintOutput()    Dim name As String
        name = "John"
        SayHello name
        Debug.Print name
    End Sub
    
    Private Sub SayHello(ByRef theName As String)
        Dim name As String
        name = "Hello, " & theName
        Debug.Print theName
    End Sub
    6. In the included Sample.xlsm file is a module named "Test" with a subroutine named "Question6". Are there any changes you would make to this subroutine/module? If so, why?
    It uses selections with is never good there is no need to select the cell to work with it. Also there are better ways to find he last row in a data range. Declarations of variables are usually at the beginning to improve readability. Also the last variable was incorrect. It would be good to use option Explicit to make sure all variables are declared and used.

    The original code:
    Sub Question6()    Range("A1:B1").Select
        Range(Selection, Selection.End(xlDown)).Select
        
        Dim startTime As Date
        startTime = Now()
        
        For i = 2 To Selection.Rows.Count
            Debug.Print Cells(i, 2)
        Next
        
        Debug.Print Now
        
        Dim endTime As Date
        endTime = Now()
        
        Dim timePassed
        
        timePassed = DateDiff("s", startime, endTime)
        
        Debug.Print timePased & " seconds have passed"
    End Sub

    The fixed code:
    Option Explicit
    Sub Question6()
    
    Dim i As Long
    Dim startTime As Date
    Dim endTime As Date
    Dim timePassed As Long
        
        startTime = Now()
        
        For i = 2 To Range("A1").CurrentRegion.Rows.Count
            Debug.Print Cells(i, 2)
        Next
        
        Debug.Print Now
        
        endTime = Now()
           
        timePassed = DateDiff("s", startTime, endTime)
        
        Debug.Print timePassed & " seconds have passed"
    End Sub
    7. In the included Sample.xlsm file there is a sheet named "Sample Data" that represents a key/value pair. column A is the key where column B is the value for that key. Write a new function named "Question7" in the "Test" module. It must accept a number as a parameter, look up that number as the key, and return the value for that key.

    This question freaked me out too when I read it and I saw "Items" and "Keys" I was oh no they want me to make a collection, something I not too familiar with...ok I will admit it Arrays and collections are extrememly hard for me. lol But kept calm and I hoped the intellisence would help me ( was reading about scripting.dictionary last night)

    This was the code I came up with:
    Function Question7(iNumber As Integer) As String
    
    Dim lRow As Long
    Dim rFound As Range
    
    lRow = Sheets("Sample Data").Cells(Rows.Count, "A").End(xlUp).Row
    
    Set rFound = Range("A1:A" & lRow).Find(What:=iNumber, LookIn:=xlValues)
    
    Question7 = rFound.Offset(0, 1).Value
    
    End Function
    After I finished we spoke for a little while and he told me that for this question he was expecting me to use worksheetfunction.vlookup() but that thats just what he thought that my approach was correct.
    He wanted a single line code like this:
    Function Question71(iNumber As Integer) As String
    Question71 = WorksheetFunction.VLookup(iNumber, Sheets("Sample Data").Range("A1:B" & Cells(Rows.Count, 1).End(xlUp).Row), 2, False)
    End Function
    So thats all. He told me he was happy with the results. He was also happy that I finished the test a little before time was up ( not a lot lol 5 min).

    Then he went on asking about availability for a second interview. He didn't tell me there was going to be one yet. But I think things look very good.

    Once again thank you guys for all the advise and support. I will keep you posted.
    Feedback is the best way for me to learn


    Follow the Armies

  16. #16
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    ok I will admit it Arrays and collections are extremely hard for me.
    You absolutely, positively must get past that.

    This will be just enough to get you started. BTW, you used a Collection 4 times is question 4 on your test.

    A Collection is the easiest of the three. Basically, you just throw Objects in and take them out with a For...Each. They are automatically assigned a number, (Long,) starting at 1, as the Key. A collection is the only one of the three that you can use a For... Each loop with. Collections are one of the advantages VBA has over other languages. Collections are generally used when you don't care about the order you put things in, so you usually don't bother with a Key. A bucket if you wish. Actually it's more like a endless tube you fill from the top and empty from the bottom. A Collection is an Object that Microsoft made for us to use.

    They are easy to build
    Dim I-OControls As Collection

    An Array is finite block of RAM Memory that the VBA Compiler sets up for our use, but you can also think of it as of boxes laid side by side, but you have to set all the boxes that you think you will need at the time you build the Array, (so if you don't know how many boxes you need, you should use enough to handle any contingency, it's only Memory.) An Array only has Indices, (Actually: Memory offsets,) and Values. The Indices are numbers starting at 0 and going up as needed to ID all the boxes. (Count - 1)

    When you declare an Array, you have to tell the Compiler what Variable Type you are using and how many possible units you want to store. The Compiler will use the Variable Type memory requirements and unit count to assign the Memory block.
    Dim PhoneNumbersUSA(100) As String(17) '100 * (17 * (Bytes/Character))
    'Note that MS Memory management is excellent. Don't use fixed length strings. MS does it better.
    If you want the first Value stored in that Block of Memory, don't use an Offset. Use 0 for the Index number. If you want the third value, then offset 2 from the start of memory. Now you know why Array indexes start at 0.

    A Range is like a Photon, It's a Collection and an Array, depending on how you look at it.

    A Dictionary is another Object MS made for us. It is a wired combination of a collection and an array. Like an Array, you have to loop thru it by Index Number
    For i = 1 to Dict.Count
    Like a Collection you can retrieve Items by Key. Uniquely, you can use Objects as the Key. Unlike an Array, it can't hold UDTs.

    A Dictionary is built with two Arrays (Keys and Items) with linked indexes, such that the index# of the Key array is passed to the Items array for retrieval.You can load (Add) the Keys Array now and randomly load the Items Array later by referencing the Keys' Values
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  17. #17
    Thanks a lot for the detailed explanation SamT. I understand the basic concepts of the arrays, the problem comes when I have to implement it in code. I have seen in forums all around the web and programmers use arrays to get data from the sheet and then they manipulate it, expand it using redims and them just put it back on the sheet.

    Right now I am trying to grasp the concept from This Thead Post #8 I mean this guys solved this using arrays and dictionary.

    Thanks a lot for your post again SamT.
    Feedback is the best way for me to learn


    Follow the Armies

  18. #18
    VBAX Regular
    Joined
    Dec 2013
    Posts
    14
    Location
    I agree with Sam, collections and dictionaries are really useful in VBA due to the poor features of arrays, but a bit of clarification if I may,:

    Quote Originally Posted by SamT View Post
    Collections are generally used when you don't care about the order you put things in, so you usually don't bother with a Key. A bucket if you wish. Actually it's more like a endless tube you fill from the top and empty from the bottom.
    I find this a little contradictory, actually the key benefit of a collection over a dictionary is that you can rely on the order of elements - they aren't guaranteed in a dictionary, as such you can use collections like a stack. That's why you can add items by index into a collection using the additional parameters in the Add method, dictionaries can't offer this functionality.

    Quote Originally Posted by SamT View Post
    A Dictionary is another Object MS made for us. It is a wired combination of a collection and an array. Like an Array, you have to loop thru it by Index Number
    For i = 1 to Dict.Count
    This isn't strictly true, you can use a for each construct on an array, which is all the items method returns anyway, it's just not as efficient. You can also return the Keys of a dictionary, which you can't do with a collection.
    Quote Originally Posted by SamT View Post
    Like a Collection you can retrieve Items by Key. Uniquely, you can use Objects as the Key. Unlike an Array, it can't hold UDTs.
    Nor can a collection, but they can both hold objects which will overcome this
    Quote Originally Posted by SamT View Post
    A Dictionary is built with two Arrays (Keys and Items) with linked indexes, such that the index# of the Key array is passed to the Items array for retrieval.You can load (Add) the Keys Array now and randomly load the Items Array later by referencing the Keys' Values
    Which is useful as you can't do with a collection, simple types are not editable once in a collection.

    Don't get too bogged down with snb's and jindon's code, they have nifty solutions; which are usually very efficient but hardly follow good practice. They tend to use concise variable names and no comments, the code is completely cryptic to other people maintaining the code and even to yourself when coming back to it 6 months later. I'd have long clean, readable code with comments and useful variable names over the shortest code possible any day. When writing code, the question you need to ask is "how easy is this going to be to change in 12 months time when I can't remember what it does?"

  19. #19
    I will have to do more research on this matter. For now I can use an array when I think I need one an a collection when I need one. Nothing too fancy though.

    I will use arrays to go through lists, load arrays with lists or strings or values and them use them to for example see the recurrence of a specific string.

    I will use string collections to add unique values. Other collections as sheets and range I use them to go through each item and perform a task.

    I know that the codes from jundon and snb are extremely condensed I see like some kind of challenge. I wish there was a VBA book with exercise to sort of make the knowledge stick. It works for me and .NET lol

    Thanks a lot for the comment. The important thing here is to learn and don't get frustrated.
    Last edited by fredlo2010; 12-18-2013 at 07:17 AM.
    Feedback is the best way for me to learn


    Follow the Armies

  20. #20
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    good luck fredlo
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •