Comments on: How to insert and run VBA code in Excel - tutorial for beginners

This is a short step-by-step tutorial for beginners showing how to add VBA code (Visual Basic for Applications code) to your Excel workbook and run this macro to solve your spreadsheet tasks. Continue reading

Comments page 10. Total comments: 256

  1. Is cut and paste between worksheets disabled in macro-enabled worksheets? I thought this would be an easy answer for the internet, but can't find it.

  2. Hi,

    I have run a code but my excel refuses to save when exiting the workbook

  3. Hi,

    Thanks for sharing this, it was really helpful.

  4. What if you only wanted to apply that VB code to only a couple of columns with the names "Items" and "No."?

    1. Hello Ryan
      As far as I understand, you have a VB code that you want to modify in the way to apply it only to certain columns.
      If it is your case, I am sorry we can't help you with this. Please look for the solution on these forums: http://www.mrexcel.com or http://www.excelforum.com

  5. Hello i am newer to this course so can any one tell me how to start with VBA concept.

  6. Hi, my data is about shift schedules, when i run my macro, it does read the shift schedule except that it doesnt count the days (per day, like monday -sunday), whenthe employee has a shift...why isnt my macro reading the data? I pasted the data on a separate tab within the same worksheet. Pls help!

  7. Great post thanks for help me out!

  8. hi, i am Dheeraj i am new in excel so i have some Question that how add any formula in micro in excel and how to treat excel as like my sql

    1. Hello Dheeraj,

      You are asking very generic questions that do not directly relate to the topic covered in this article. I would advise you to find some good book on Excel or online tutorials that are plenty on the web.

  9. Thank you, thank you, thank you.

  10. I am sanjeev .I am new in excel....so could u plzzzzzzzzz help me to sove my problem????????

    I write ,i code in VBA in excel...........
    to move from one sheet to onther by active x control command button.

    command button in first sheet1............

    worksheets("sheet2").activate

    it works..........by this i can go ,into second sheet.
    but as i close my sheet ,and reopen it ,it not works...........(means code disappears).

      1. How to save module in excel sheet as proper way to described.

  11. Hi, I want to link some pdf file data to excel using macro.Is it possible?

    1. Parvin - I just wrote a macro that pull data from the filled fields in a PDF

    2. Hello parvin,
      I am not sure I fully understand your requirement. Can you please explain in more detail?

  12. Hi,

    I prepare a report everyday, can it not be done with the help of macro.
    I downlaoad the raw report it from my client system and then format it and I use some simple formulae like sum, vlook up.

    Everyday the raw date keeps changing.

    please suggest at the earliest, how this can be done.

    Thanks,
    Rumana

  13. Hai Alexander, I know bit of Macro, but the below lines are new to me.
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Very Interesting to know about this TIP, that it will increase the execution to a great extend. Thanks for the Info. :-)

  14. I need help badly, I need macro-excel where:
    1) multiple rows of surnames in one column and firstnames in another column
    2) have to copy each name surname and first name to be pasted website asking for each in separate webpage boxes
    3) then I have to copy the printscreen result to another worksheet and resume to another row (new firstname and surname)
    Need a as this is a big project but few people/time
    Thanks, Alexander!

    1. Sorry, I cannot suggest a solution off the top of my head. This kind of task requires some research and coding. You can try searching for a solution on Excel forums like Mrexcel.com or excelforum.com

  15. I may be missing something, but even after pasting some code in, there is no macro listed when I use Alt+F8 - the window is blank.

    What step did I miss (that is not listed on this page?)

    1. Hi Robert,
      I described all the needed steps in the article. Please make sure that the code you pasted contains the part beginning with Sub MacroName and ending with End Sub.

      1. I get an error when I put that in there.
        "Compile error:
        Expected: line number or label or statement or end of statement"

  16. I have cut/paste the formula once again in MS Word and then from there - copy/paste into module. It now shows up normal (rather than the 2 red lines of words in my previous post)

    so, now that its there...
    1. I saved the workbook as excel macro-enabled workbook
    2. Clicked ALT Q - to go back to my workbook
    3. I then ALT F8 to run it - but there is nothing there... blank....

    what am I missing? At this point - do I run the macro BEFORE I try to do what I want accomplished (uie: add sum of each yellow cell)?
    I think I am missing a step here. Your tutorial seems pretty well explained. I was very pleased and thought I understood it.... but I feel like Im missing a step somewhere....
    Thank you for your help.

    1. I'm not sure if people are still looking at this forum... but I have the same exact problem as Angel.

    2. Your Sub/Function can not be Private.... If they are, they won't be visible when you press Alt-F8.

  17. hello,
    when I copy and paste the formula (the one found in how to count by color and sum by color in an exel worksheet tutorial)into the module of my worksheet - it does not look the same. the letters are red and instead of line by line - it looks like it was a continuous formula (actually took up only 2 lines)

    so anyways - i tried to run it (alt8) and it is black - it seems like it does not recognize the formula I pasted.

    so I cut and pasted the formula into word document - and it took a few pages - and when I cut and copied it from there - it showed a solid line where the I copied onto the next page)

    any suggestions? am I doing some thing wrong?

    1. * correction - it is blank - no black

  18. Thanks for the reply. Any suggestions for why that macro may not work in 2013?

  19. Do you have any idea why some VBA code that works fine in Excel 2010 would lead to a "Microsoft Excel has stopped working" error in Excel 2013?

    Thanks,

    Jim

    1. Hi Jum,
      It's hard to say what may cause this without seeing your data. You can send me your workbook at alexander.frolov@ablebits.com and I will try to help.

      1. i made a excel vba. it works but when i close it and open it again the vba doesn't work but the codes still there what is the problem... can you help me? thank you!!!

    2. Hello Jim,
      There may be various reasons. But I do not think this is a compatibility issue because Microsoft really cares to make Office applications backward compatible.

  20. Hello There,

    Iam not able to click on module,i can see it but not able to click, can anyone help on this.

    Regards
    Syed

    1. Sorry, I do not exactly understand the problem. Can you please send me a screenshot at support@ablebits.com?

      1. Sir i want to highlight the entire cell in excel..for this purpose i use the VBN and but in vbn when i open the module the dialog box show empty but in one video i saw when click on module open the detail.but i cant saw this wording can u help me?

  21. Hi,

    I required a VBA Code for Updating a Bulk excel into a Application(Oracle) Data batabase & to Execute the same through the excel to Application.

    Ex :- The Complaint is to be closed in the system for this there are 4 Columns 2 are of Drop down & 1 is of Text field to Update a Remark, & in the 4th Column Present Date & Time will be appearing that has to remain Same.

    Regards,
    Hemanth C
    9449330057

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)