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
by Alexander Frolov, updated on
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 8. Total comments: 256
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
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?
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
I m give information for vba programing
Ripper, thanks for this
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.
i m new to this excel and vba but i know vb how to work on this
sry
fhfghgvnvfdg
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
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.
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.
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
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...?
Can you tell which book is Best to learn macro in easy way to implement macros in excel**********
Hi, everytime I save as on excel I get strange symbols characters after the file name this is for excel 2013.
can u tell which book will be best to learn macro
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.
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.
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
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
please explain me how to enable or disable .bas in excel
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
Less tension more work - more work less tension
How.. ?
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
I will like to code my page in excell pla how do I do it.
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
can i ask one code in excel macro how can we "enter" using a macro code
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.
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.
Thank you for this! You saved me a ton of work of having to do this manually! Very simple instructions with amazing results.
How can I create the custom toolbar with VBA code as addins sothat it can work for any computer.
or there is any installation file that I need to create.
Please help me??????????
Hello Chetan,
I am sorry, we can't help you this. Please post your question on the http://www.excelforum.com or http://www.mrexcel.com forums, they may assist you better.
Hello, This is Chetan
I have created one custom toolbar as addins that has so many buttons with assigned macros and my query is When I am giving to the client he is not able to use that toolbar???? Here I am able to export the customization that i did but unable to export the VBA code that I have written, after some R&D I came to the point there is one Personal.xlsb file that I need to copy to the client machine on specific XLSTART folder but it's not working because the Psersonal.xlsb is specific to me (specified user who has created )on other system it is asking for my computer location..
So How can i resolve the issue so that it can work for any computer
please help me???????????
What is the desired output of the above Macro file?
Please let us know since we are new to this.
what if i already have an VB code and i just want to run this code using excel !
do you have any idea about how to do this ?
Hello Lina,
This is exactly what is told in the article. Could you please specify on what step you have difficulties?
I want to appended 50 excel files on daily basis. please tell me how to do that on micro level
Alexander, great post.
I have a doubt about sending a "macroed" excel worksheet to execute in another computer.
The end user will need to have any special permission to execute macros? (no ActiveX included)
Because i am planning to distribute an excel file (made in 2010 or 2013), with macros/forms, but i am afraid that it will not be compatible with other excel versions or missing configuration/installed apps in users computers (and i don't have control over those as the file will be to open public).
Do you know where i can get more information about this?
Thanks in advance!
Hi,
I want to lock some of cells ( in all worksheet within a workbook including adding new worksheet, and also do not want to move excel cursor on that cells.
Where should I type code i.e in module or at workbook.
Example:
Lock cell (A1:C2) and (D2:F4) and (B1:B12) in worksheet as well as adding new worksheet withing a workbook.
I am trying to input VBA code to determine the indentation in an excel 2010 row.
the followin was taken from a different forum but When I insert the the code I get and run error message compile error ambuguous name detected: indenture
this is what I pasted into the window
Sub indenture()
Function indenture(r As Range) As Integer
indenture = r.IndentLevel
End Function
Hello, Paul,
The first line is redundant, you just need:
Function indenture(r As Range) As Integer
indenture = r.IndentLevel
End Function
Excellent article, I don't think it could have been made any more simple. Thanks
I can't understand properly.
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.
Hi,
I have run a code but my excel refuses to save when exiting the workbook
Hi,
Thanks for sharing this, it was really helpful.
What if you only wanted to apply that VB code to only a couple of columns with the names "Items" and "No."?
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
Hello i am newer to this course so can any one tell me how to start with VBA concept.
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!
Great post thanks for help me out!
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
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.
Thank you, thank you, thank you.
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).
Hello sanjeev,
Please ask your question on http://www.mrexcel.com or http://www.exceforum.com boards. They have forums especially for VBA questions.
How to save module in excel sheet as proper way to described.