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 7. Total comments: 256

  1. it is way too complicated i just want a print screen macro

  2. Worked great! I didn't bother with any of the added code. Thanks!

  3. Can anyone tell me that how to run any of macro program in excel?

  4. I entered a VBA for excel 2013. I wanted to make a drop down list w/ multi items to select. It works perfectly for me, but when I send it to my associate it does not work...only single selection is possible. Is that because they do not have a, "developer" ribbon? I cannot have everyone do that....so is there a workaround? Thanks for your valuable time!

  5. thank you sir for treating my worries

  6. how do i run a vba code using a macro such that each time i click on the macro, it runs my vba code

  7. Thanks for the Aritical.

  8. Delete entire row from A2 downwards with the word "0o,rb,t"in column A

  9. Hello,

    I am trying to import data from certain columns from an excel sheet "MyData.xlsx" into "PriceInc.xlsx"

    There is a button on the "PriceInc.xlsx" file that, when clicked should bring in the required data.

  10. Hi , I just started with VBA using it for the first time , I wrote code under module but When I am clicking on "Run".
    It is not giving me any result.

    Suppose I use a command :
    Sub hello()
    MsgBox ("Helloworld")
    End Sub

    When I am running it , it is not getting published in Excel workbook

    1. Hi, khush

      Sub hello()
      MsgBox "Helloworld"
      End Sub

  11. Plz Send All details With Screen Shot.that how to create VBA in Excell Sheet

  12. Thanks!

  13. I am opening a "shared" spreadsheet, that sits on our Corporate NAS. I have copied the file off the NAS to my home computer, in order to add some VBA code - for displaying the sheet and refreshing at set intervals. However, when I open the Developer tab and attempt to right click on the sheet, all my options are greyed out? Is this because the sheet has been placed in "shared mode" from within Excel (not sure how to disable that and add the code, then re-enable shared mode). I will need to put it back on the NAS when the code has been added. NB: The VBA code was produced by a freelancer at guru.com to refresh each of the four tabs on the sheet, every 15 seconds.. Thanks! (I have a screen capture I could send you).

  14. Thank you, Alexander.

    You have solved my problem.

  15. I want to create a data base using excel i want to create it where if i search the item the prices and purchased store will appear

  16. Hi i have used the line break formula, and it is working great.

    Further please help in make macro to break line. As in if there are double spacing in between two words, then that should come in the next line of the cell.

    Thanks

  17. Hi,
    I want to put a macro to getting the first line bold on the selected column

    Please help!

  18. I created a little ActiveX control (spin up/down)via VBA for my PPT chart. But I can't find anywhere in the videos how to save it in order to use it. Can someone please tell me how or direct me where to go? Thanks.

  19. Hi ,

    Can you please share a copy of a worked file on which macro is created and run to my mail Id as in shared. just to take it as a example and work with

    Regards,
    Chandini.E

  20. I would like to create a macro where you go through the steps to insert a picture into a comment, but i would like to have the macro stop at the insert picture screen so it is simple for whoever is using the document can go directly to the insert a picture popup and finish the request.

  21. Sir,
    now, i want to make Dashboard to Summarise the Sales data, Return, & Stock , Date wise transaction & Unique Column is SKU Code, kindly help me how to process it on every 7 Days, if you have any templet as our Requirement , then pls provide.

    Thanks
    ashish

  22. hi

    How do i change excel sheet1, sheet2,.... at the bottom of the screen, to appear as a navigation tab on top of the screen?

  23. Hello Alexander.

    Could you please let me know why the below code is not running when I click on Run button, there is no response nor error message populated.

    Sub LoopThroughDirectory()

    Dim MyFile As String
    Dim erow
    MyFile = Dir("C:\Users\r628956\Desktop\Salesforce\Rating\Automation\Master")

    Do While Len(MyFile) > 0
    If MyFile = "zmaster.xlsm" Then
    Exit Sub
    End If

    Workbooks.Open (MyFile)
    Range("A2:D2").Copy
    ActiveWorkbook.Close

    erow = Sheet1.Cells(Rows.Count, 1).End(x1Up).Offset(1, 0).Row
    ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range

    MyFile = Dir

    Loop
    End Sub

    Thank you - Rajkumar

  24. I m give information for vba programing

  25. Ripper, thanks for this

  26. Hello All .Very useful article. Would you be able to to help me for the following : i have a text in Excel worksheet that i want to copy and paste into Excel VB Standard Module . Currently I can do it using "Cntl C" to copy and then Cntl V " to paste into Excel VB Module . Can you please suggest some other method of how it can be done without pushing the above buttons.

  27. i m new to this excel and vba but i know vb how to work on this

  28. sry

  29. fhfghgvnvfdg

  30. Hi im not able to run 2 different modules at the same time using the spellnumber formula i want to be using it for 2 different currencies
    kindly advise

  31. hello, could anyone help me learn excel macro. i work on automation. im on my training period. and as of now my task is to create the popup calendar, meaning, i need to find people who hav joined on that particular date. i should get the popup calendar, when i click on a particular date, i must get the list of people who hav joined into the organization on that day.

    thanks.

  32. morning

    i copied your coding into my excel and saved it correctly, but when i open the file again it gives me an error. when i press alt F8 there are not macros on the list for me to chose from. when i open a new sheet and redo everything then it works but as soon as i save that file and open it i get the same result.

  33. Hello Alexander.

    Could you help me with the VBA code to complete the following task:

    I have an excel table. Assuming the formula goes in column D starting the cell D1,

    For i=1 To Countif(A:A,"*")
    Do Until True
    If Left(C1,B(0+i))=A(0+i) Then A(0+i)

    Here B(0+i) should start from B1,then B2, etc. until C1=A1 or A2 or etc.

    For D2 the VBA should do,

    For i=1 To Countif(A:A,"*")
    Do Until True
    If Left(C2,B(0+i))=A(0+i) Then A(0+i)

    Thanks

  34. I have visual program of timestamp whenever i enter sonething time will note....is it complusary to create a macro nd assign prog in it..? Der is no direct method to save dat prog in excel...?

  35. Can you tell which book is Best to learn macro in easy way to implement macros in excel**********

  36. Hi, everytime I save as on excel I get strange symbols characters after the file name this is for excel 2013.

  37. can u tell which book will be best to learn macro

  38. creat your own funcation -
    Access include many built -in ,or instrinsic ,funcation an intrust payment. you use these funcation to perform calculation without having to creat complicated expressions .using VBA, you can also creat your own funcation to either perfom calculation that excced the capability of an expressions or replace complex expressions you have written in your application.

  39. Hi,

    I have VBA code in Sheet3 column A of my excel file. I want to assign a button in sheet1 A1 to copy the vba code from sheet3 colum A and run the script.
    I am not able to put the code to open VBA through macro.
    Please help.

  40. Can please give information regarding
    what are the changes that we have to take into account while working excel VBA 2014??
    all my codes are written in VBA 2010 but code are not working in 2014 VBA ?? so please suggest me regarding this

  41. hi.
    i am working on excel workbook having 1000 worksheets.i want to extract data from all 1000 sheets in rangs(A6, A13:A15, A30:A34, A36:A40). Data present in workbook, are in the above said position in all of the worksheets. so someone provide me a macro for doing this thing.
    thank you for help

  42. please explain me how to enable or disable .bas in excel

  43. Good afternoon

    I have a spreadsheet with about 49,000 lines in it, I need to insert 9 lines between each line of text and am having some issues with the Macro to use. There is only 1 column of text and I just need to insert 9 blank lines between each line of text.

    Is someone able to point me in the right location to get the code to create the macro to do this please?

    Thank you in advance
    Rob Garven

  44. Less tension more work - more work less tension

    How.. ?

  45. hi, i'm jey i want some help i want the exell sheets chenge in between some time limit how to develop it plese send me the code or tips

  46. I will like to code my page in excell pla how do I do it.

  47. Hi,

    I'm trying to make it so that only one person can access the workbook at once and if anyone else tries do use it they will get a message saying that it's in use by another user.

    I have found the code below on another forum but it doesn't seem to be working - The Macro name won't appear when I try to run it. I think it's to do with the beginning section of code? Your help would be much appreciated!

    Many thanks, Tamsyn

    Private Sub Workbook_Open()
    With Me
    If .ReadOnly Then
    Call MsgBox(Prompt:="The workbook is already open by another user!", _
    Buttons:=vbExclamation + vbOKOnly, _
    Title:="Closing...")
    Call .Close(SaveChanges:=False)
    End If
    End With
    End Sub

  48. can i ask one code in excel macro how can we "enter" using a macro code

  49. If I create a VBA code in Excel version 2010 will it work by someone who has other versions of Excel including 2013 as 2007?
    I want to send a form where the letters automatically change to UPPERCASE when anyone with any kind of excel version types in the cell.

    1. Hello Christophe,

      Yes, of course. Your code should work in all the versions of Excel you mentioned and even in Excel 2003.
      It won't work in earlier versions only if you are calling new functions of Excel 2010 – 2013 there, but it doesn't look like your case.

  50. Thank you for this! You saved me a ton of work of having to do this manually! Very simple instructions with amazing results.

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 :)