This will refer to all the cells in the range A1:A20 that hold the value “SalesVolume” You can even nest ranges inside each other and select specific strings: Range(“A1:A20”, Range(“SalesVolume”)) This will select cells which have the value of “SalesVolume”.
Range can accept not just cell names and ranges, but also strings: Range(“SalesVolume”) This should be a specific cell name (“A1”) or a range of cells (“A1: A10”).Ĭell 2 (optional) = The top-left or bottom-right of the cell range to be selected. Cell 2)Ĭell 1 (required) = The actual range/cell to be acted on. The basic syntax of the VBA range command is as follows: Range(Cell 1. You will use the Range function a lot in your VBA programming since it makes selecting a cell or a range of cells so effortlessly easy. As of now, Excel does not support multi-dimensional ranges (i.e. Multiple non-contiguous cells – the same as CTRL + Clicking cellsĮvery cell selected in the range must be within the same worksheet. One cell (even a single cell selection is called a range) What is Range?Ī range, as you might have guessed, refers to a cell or a range of cells. For a more in-depth discussion on selecting ranges in VBA, consider taking this course on Visual Basic for MS Excel. I’ll also show you practical examples on how you can do this in your Excel workbooks.
To request this page in an alternate format, contact our staff.Every Excel user is familiar with selecting a range of cells – by SHIFT + Clicking, CTRL + Clicking, or dragging the mouse over a range of cells.īut how does one select a range in VBA? In this article, I’ll guide you on how to select a range of cells and activate a particular cell in that range. Register Now for a public course at our downtown Toronto location at 1 Yonge Street, Suite 1801 (Toronto Star Building), Toronto, Ontario, Canada.ĭo you need more information? Contact us! Microsoft Word: Visual Basic for Applications (VBA) Macros | Introduction > Microsoft Project: Visual Basic for Applications (VBA) Macros | Introduction > Microsoft Word VBA Microsoft PowerPoint: Visual Basic for Applications (VBA) Macros | Introduction > Microsoft Project VBA Microsoft Excel: Visual Basic for Applications (VBA) Macros | Intermediate > Microsoft PowerPoint VBA Microsoft Excel: Visual Basic for Applications (VBA) Macros | Introduction > Microsoft Access: Visual Basic for Applications (VBA) Macros | Introduction > Microsoft Excel VBA You can attend a public course at our Toronto location or arrange a custom course at your site or ours as instructor-led classroom (ILC) or, for remote users, as virtual classroom (VC) courses.Ĭontact us to discuss any of our custom options.Ĭheck out our blog for more tips, tricks and shortcuts.Ĭlick the courses below to view the course outline and course fees.
Learn keyboard shortcuts, quick tips and tricks while learning to program using VBA even if you have never programmed before. Visual Basic for Applications (VBA) Courses Instructor-led Classroom and Virtual Classroom Training Microsoft Office VBA Training SeriesĪvantix Learning offers VBA (Visual Basic for Applications) courses for non-programmers.