In this video, you will learn to write a code to sum values from a range of cells. To write a code for this, you need to use the Worksheet Function property. So make sure to watch this video till the end.
➡️ Subscribe NOW ➜ https://bit.ly/free-excel-videos 👀
📰 Transcript
Hey, this is Puneet back again. And welcome to our VBA series where we learn to write codes in Excel. And before we jump in, make sure to subscribe to the channel so that you won't miss any of these videos in the coming weeks. And now let's get started. So here we will look at how we can write a VBA code to SUM values from a range of cells. Now for this, I'm going to go to the Developer tab and then open the Visual Basic editor and then go to the insert option and then module. So here's my new module where I'm going to write the code. Let me name the macro first. Now the first thing that I need to use is the application object and then the worksheet function. So when you use this WorksheetFunction property, it gives you access to all the functions that you have in Excel. So as soon as I enter dot it shows me a list of all the functions that I have in Excel. And from here I'm going to use the sum function. And now I'm going to specify the range for which I want to calculate the sum. That's the range A1 to A16. Now I'm going to use the cell B1 to get the result of this function. All right, so if I run this code, it returns a sum of all the values that we have in range A1 to A16 in cell B1. So you need to use the worksheet function and then you need to use the sum function and you need to specify the range from where you want to calculate the sum. And if you want to sum values from an entire column, in that case, you simply need to specify the column in this way. So this will actually sum all the values from column A. And if you want to go with an entire row, in that case this will be like this, the row one, or if you want to go with row two or row three, so on and so forth. All right, so that's it for this video. I hope you found this quick VBA tip useful. And if you want to learn more, make sure to subscribe to this channel because I'll be coming out of a lot of cool VBA tips and tricks in the coming weeks.
🔥 Top Excel Videos ➜ https://bit.ly/top-excel-video
📚 Download Our Excel Productivity Bundle ➜ https://bit.ly/free-excel-bundle
🔌 Connect on Twitter ➜ https://bit.ly/excel-champs-twitter
🌐 Learn Coding in Excel ➜ https://bit.ly/excel-programming
✅ 100 Excel Tips ➜ https://bit.ly/top-excel-tips
#ExcelVBA #LearnVBA #VBATutorial #VBA
About ExcelChamps: The ExcelChamps YouTube Channel is the part of ExcelChamps.com Blog that helps people to learn Microsoft Excel by providing some high-quality blog posts. On ExcelChamps YouTube Channel, we provide videos of the same quality to make education more accessible to the people out there.