How to Use Labels in VBA Code

Save

Visual Basic for Applications (VBA) is a subset of Visual Basic that's used exclusively with Microsoft Office applications. When you use VBA in conjunction with Excel, there are two ways to reference a cell: select the cell using the Column/Row reference, or select the cell using the cell label. Labels can also be used to refer to ranges of cells in Excel. When you give a cell, or range of cells, a label, you refer to that name in your VBA code.

Things You'll Need

  • Excel 2007 or Excel 2010
  • Insert a new line into your VBA code where you want to add the cell reference.

  • Type: Range("Name").

  • Replace "Name" with the label. For example, if your label is "taxes," your code would read: Range("taxes").

References

Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!