Select one cell in excel vba

VBA Select Cell

VBA Select Cell

MS Excel provides several VBA inbuilt functions one of them is the Select a Cell Function, which is used to select a cell from the worksheet. There are two methods to select a cell by the Cell another is the Range. It can be used as the as a part of the formula in the cell. A cell is a property in the VBA, but Range is the Object, so we can use a cell with the range but cannot use the range with the cell.

As an example, if the user wants to give a reference for A5 then he can give by two way one is select a cell by the Cell (5,4) another is the Range (“A5”).

The Syntax of the Select Cell Function:

SELECT CELL () – It will return the value of the cell which is given in the reference. There are two ways to select a cell.

Ex: Select Cell function –

ActiveSheet.Cells(5, 4). Select

OR

ActiveSheet.Range("D5"). Select

How to Select Cell in Excel VBA?

We will learn how to select a cell in Excel Using VBA code with few examples.

You can download this VBA Select Cell Excel Template here – VBA Select Cell Excel Template

VBA Select Cell – Example #1

How to use the basic VBA Select Cell Function in MS Excel.

A user wants to select a header cell which is C5 and User name(D5) in his workbook, after that print this name in the workbook which is given in the reference given cell is D5.

Let’s see how the Select Cell function can solve his problem. Follow the below steps to select a cell in excel VBA.

Step 1: Open the MS Excel, go to sheet1 where the user wants to select a cell and display the name of the user.

 VBA Select Cell Example 1-1

Step 2: Go to the Developer tab >> Click on the Visual Basic.

VBA Select Cell Example 1-2

Step 3: Create one Select Cell_Example1() micro.

Code:

Sub Select_Cell_Example1()

End Sub

VBA Select Cell Example 1-3

Step 4: Now activate sheet and select the user’s name cell by the Cells method.

Code:

Sub Select_Cell_Example1()

  Sheets("Sheet1").Activate
  Cells(5, 3).Select

End Sub

VBA Select Cell Example 1-4

Step 5: Now select the User name cell which is D5 by Range method.

Code:

Sub Select_Cell_Example1()

  Sheets("Sheet1").Activate
  Cells(5, 3).Select
  Range("D5").Select

End Sub

VBA Select Cell Example 1-5

Step 6: Now print the User name.            

Code:

Sub Select_Cell_Example1()

  Sheets("Sheet1").Activate
  Cells(5, 3).Select
  Range("D5").Select
  MsgBox "User's Name is " & Range("D5").Value

End Sub

VBA Select Cell Example 1-6

Step 7: Click on the F8 button to run step by step or just click on the F5 button.

Result of Example 1-7

Summary of Example #1:

As the user wants to select the cells and display the value in that cell. He can achieve his requirement by Select cells and range method. Same we can see in the result.

VBA Select Cell – Example #2

How to use the VBA Select Cell Function with the Range in the MS Excel.

A user wants to select the cell Delhi which is B7 as the first cell of a range. So, by default, there is a data range which is A1 to C13. But the user wants to create his own range and from where he wants to select the first cell.

Let’s see how the Select Cell function can solve his problem. Follow the below steps to select a cell in excel VBA.

Step 1: Open the MS Excel, go to sheet2 where the user wants to select a cell and display the name of the user.

VBA Select Cell Example 2-1

Step 2: Go to the developer tab >> Click on the Visual Basic.

Step 3: Create one Select Cell_Example2() micro and inside declare a string as the select_status.

Code:

Sub Select_Cell_Example2()

  Dim select_status As String

End Sub

VBA Select Cell Example 2-2

Step 4: Now activate sheet, define a range from B7 to c13 and select the first cell in that defined range.

Code:

Sub Select_Cell_Example2()

  Dim select_status As String
  Sheets("Sheet2").Activate
  select_status = Range("B7:C13").Cells(1, 1).Select

End Sub

VBA Select Cell Example 2-3

Step 5: Now print the status of selection if it is selected then it will be true otherwise false.

Code:

Sub Select_Cell_Example2()

  Dim select_status As String
  Sheets("Sheet2").Activate
  select_status = Range("B7:C13").Cells(1, 1).Select
  MsgBox "Selection Action True/False: " & select_status

End Sub

VBA Select Cell Example 2-4

Step 7: Click on the F8 button to run step by step or just click on the F5 button.

Result of Example 2-5

Summary of Example #2:

As the user wants to define their own range and from where he wants to select the first cell. He can achieve his requirement by Select cells and range method. Same we can see in the result. As we can see in the result selection happed on Delhi which is the first cell of defined range by the user.

VBA Select Cell – Example #3

How to use the VBA Select Cell Function with the loop in the MS Excel.

A user wants to calculate how many employees record he has in the employee details table.

Let’s see how the Select Cell function can solve his problem. Follow the below steps to select a cell in excel VBA.

Step 1: Open MS Excel, go to sheet3 where the user wants to select a cell and display the name of the user.

VBA Select Cell Example 3-1

Step 2: Go to the developer tab >> Click on the Visual Basic.

Step 3: Create one Select Cell_Example3() micro and inside declare an Integer as the i.

Code:

Sub Select_Cell_Example3()

  Dim i As Integer

End Sub

VBA Select Cell Example 3-2

Step 4: Now activate sheet and start a for loop to count the number of the employees.

Code:

Sub Select_Cell_Example3()

  Dim i As Integer
  Sheets("Sheet3").Activate
  For i = 1 To 12
  Cells(i + 1, 5).Value = i
  Next i

End Sub

Example 3-3

Step 5: Now print the Total employee records available in the table.

Code:

Sub Select_Cell_Example3()

  Dim i As Integer
  Sheets("Sheet3").Activate
  For i = 1 To 12
  Cells(i + 1, 5).Value = i
  Next i

MsgBox "Total employee records available in table is " & (i - 1)

End Sub

Example 3-4

Step 7: Click on the F8 button to run step by step or just click on the F5 button.

Result of Example 3-5

Summary of Example #3:

As the user wants to calculate the number of employee’s record available in the employee table. He can achieve his requirement by Select cells in the for-loop method. Same we can see in the result. As we can see in the result the Total employee records available in the table is 12.

Things to Remember

  • The defined range by the user is different from the regular range as we can see in Example #1.
  • A cell is a property in the VBA, but Range is the Object, so we can use a cell with the range but cannot use the range with the cell.
  • A user can pass the column alphabetic name also in cells like Cells (5,” F”) it is the same as the Cells (5, 6).
  • Selecting a cell is not mandatory to perform any action on it.
  • To activate a sheet a user can use sheet activate method as we have used in the above examples.

Recommended Articles

This has been a guide to VBA Select Cell. Here we discussed how to Select Cells in Excel using VBA along with practical examples and downloadable excel template. You can also go through our other suggested articles –

  1. VBA 1004 Error
  2. VBA Get Cell Value
  3. VBA Color Index
  4. VBA RGB

In this Article

  • Select a Single Cell Using VBA
  • Select a Range of Cells Using VBA
  • Select a Range of Non-Contiguous Cells Using VBA
  • Select All the Cells in a Worksheet
  • Select a Row
  • Select a Column
  • Select the Last Non-Blank Cell in a Column
  • Select the Last Non-Blank Cell in a Row
  • Select the Current Region in VBA
  • Select a Cell That is Relative To Another Cell
  • Select a Named Range in Excel
  • Selecting a Cell on Another Worksheet
  • Manipulating the Selection Object in VBA
  • Using the With…End With Construct

VBA allows you to select a cell, ranges of cells, or all the cells in the worksheet. You can manipulate the selected cell or range using the Selection Object.

Select a Single Cell Using VBA

You can select a cell in a worksheet using the Select method. The following code will select cell A2 in the ActiveWorksheet:

Range("A2").Select

Or

Cells(2, 1).Select

The result is:

Selecting a Single Cell in VBA

Select a Range of Cells Using VBA

You can select a group of cells in a worksheet using the Select method and the Range object. The following code will select A1:C5:

Range("A1:C5").Select

Select a Range of Non-Contiguous Cells Using VBA

You can select cells or ranges that are not next to each other, by separating the cells or ranges using a comma in VBA. The following code will allow you to select cells A1, C1, and E1:

Range("A1, C1, E1").Select

You can also select sets of non-contiguous ranges in VBA. The following code will select A1:A9 and B11:B18:

Range("A1:A9, B11:B18").Select

Select All the Cells in a Worksheet

You can select all the cells in a worksheet using VBA. The following code will select all the cells in a worksheet.

Cells.Select

Select a Row

You can select a certain row in a worksheet using the Row object and the index number of the row you want to select. The following code will select the first row in your worksheet:

Rows(1).Select

Select a Column

You can select a certain column in a worksheet using the Column object and the index number of the column you want to select. The following code will select column C in your worksheet:

Columns(3).Select

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro — A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

automacro

Learn More

Select the Last Non-Blank Cell in a Column

Let’s say you have data in cells A1, A2, A3 and A4 and you would like to select the last non-blank cell which would be cell A4 in the column. You can use VBA to do this and the Range.End method.

The Range.End Method can take four arguments namely: xlToLeft, xlToRight, xlUp and xlDown.

The following code will select the last non-blank cell which would be A4 in this case, if A1 is the active cell:

Range("A1").End(xlDown).Select

Select the Last Non-Blank Cell in a Row

Let’s say you have data in cells A1, B1, C1, D1, and E1 and you would like to select the last non-blank cell which would be cell E1 in the row. You can use VBA to do this and the Range.End method.

The following code will select the last non-blank cell which would be E1 in this case, if A1 is the active cell:

Range("A1").End(xlToRight).Select

Select the Current Region in VBA

You can use the CurrentRegion Property of the Range Object in order to select a rectangular range of blank and non-blank cells around a specific given input cell. If you have data in cell A1, B1 and C1, the following code would select this region around cell A1:

Range("A1").CurrentRegion.Select

So the range A1:C1 would be selected.

VBA Programming | Code Generator does work for you!

Select a Cell That is Relative To Another Cell

You can use the Offset Property to select a cell that is relative to another cell. The following code shows you how to select cell B2 which is 1 row and 1 column relative to cell A1:

Range("A1").Offset(1, 1).Select

Select a Named Range in Excel

You can select Named Ranges as well. Let’s say you have named cells A1:A4 Fruit. You can use the following code to select this named range:

Range("Fruit").Select

Selecting a Cell on Another Worksheet

In order to select a cell on another worksheet, you first need to activate the sheet using the Worksheets.Activate method. The following code will allow you to select cell A7, on the sheet named Sheet5:

Worksheets("Sheet5").Activate
Range("A1").Select

Manipulating the Selection Object in VBA

Once you have selected a cell or range of cells, you can refer to the Selection Object in order to manipulate these cells. The following code selects the cells A1:C1 and sets the font of these cells to Arial, the font weight to bold, the font style to italics and the fill color to green.

Sub FormatSelection()
Range("A1:C1").Select

Selection.Font.Name = "Arial"
Selection.Font.Bold = True
Selection.Font.Italic = True
Selection.Interior.Color = vbGreen

End Sub

The result is:

Using the Selection Object

Using the With…End With Construct

We can repeat the above example using the With / End With Statement to refer to the Selection Object only once. This saves typing and usually makes your code easier to read.

Sub UsingWithEndWithSelection()
Range("A1:C1").Select

With Selection
.Font.Name = "Arial"
.Font.Bold = True
.Font.Italic = True
.Interior.Color = vbGreen
End With

End Sub

In VBA, the selection one may make by a keyword method statement known as a SELECT statement. The Select statement is used with the range property method to make any selection. We will still use the range property method with the select statement and the cell reference to select any particular cell.

In Excel, we work with cells and the range of the cell. In a regular worksheet, we can select the cell by mouse or reference the cellCell reference in excel is referring the other cells to a cell to use its values or properties. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1.read more, as simple as that. However, in VBA, it is not that straightforward. For example, if we want to select the cell A1 using VBA, we cannot simply say “A1 cell”. Rather, we need to use the VBA RANGE objectRange is a property in VBA that helps specify a particular cell, a range of cells, a row, a column, or a three-dimensional range. In the context of the Excel worksheet, the VBA range object includes a single cell or multiple cells spread across various rows and columns.read more or CELLS property.

VBA codingVBA code refers to a set of instructions written by the user in the Visual Basic Applications programming language on a Visual Basic Editor (VBE) to perform a specific task.read more is a language that specifies a way of doing tasks. For example, selecting cells in one of those tasks which we need to script in the VBA language. This article will show you how to select the cell using the VBA code.

Table of contents
  • Excel VBA Select Cell
    • How to Select Excel Cell using VBA?
      • Example #1 – Select Cell through Macro Recorder
      • Example #2 – Select Cells using Range Object
      • Example #3 – Insert Values to Cells
      • Example #4 – Select More than one Cell
      • Example #5 – Select cells by using CELLS Property
    • Recommended Articles

VBA Select Cell

You are free to use this image on your website, templates, etc, Please provide us with an attribution linkArticle Link to be Hyperlinked
For eg:
Source: VBA Select Cell (wallstreetmojo.com)

How to Select Excel Cell using VBA?

You can download this VBA Select Cell Excel Template here – VBA Select Cell Excel Template

Example #1 – Select Cell through Macro Recorder

To start the learning, let us start the process by recording the macroRecording macros is a method whereby excel stores the tasks performed by the user. Every time a macro is run, these exact actions are performed automatically. Macros are created in either the View tab (under the “macros” drop-down) or the Developer tab of Excel.
read more
. But, first, place a cursor on a cell other than the A1 cell.

VBA Select cell Example 1

We have selected the B3 cell as of now.

Now click on the record macro buttonA Macro is nothing but a line of code to instruct the excel to do a specific task. Once the code is assigned to a button control through VBE you can execute the same task any time in the workbook. By just clicking on the button we can execute hundreds of line, it also automates the complicated Report.read more.

VBA Select cell Example 1-1

As soon as you click on that button, you will see a window. In this, you can give a new name or proceed with the default name by pressing the “OK” button.

VBA Select cell Example 1-2

Now, we are in the B3 cell, so select cell A1.

VBA Select cell Example 1-3

Now, stop the recording.

VBA Select cell Example 1-4

Click on “Visual Basic” to see what it has recorded.

VBA Select cell Example 1-5

Now, you will see the recording like this.

VBA Select cell Example 1-6

The only action we did while recording was to select cell A1. So, in VBA language, to select any cell, we need to use the RANGE object, then specify the cell name in double quotes and use the SELECT method to select the specified cell.

Example #2 – Select Cells using Range Object

By recording the Macro, we get to know how to select the cell. We need to use the object RANGE. Write on your own, type the word RANGE, and open parenthesis.

Code:

Sub Macro1()

Range(

End Sub

VBA Select cell Example 2

Now, it asks what the cell you want to refer to in the range, type “A1,” is. Then, enter the cell address, close the bracket, and type dot (.) to see all the properties and methods available with this cell.

VBA Select cell Example 2-1

Type SELECT as the method since we need to select the cell.

Code:

Sub Macro1()

Range("A1").Select

End Sub

VBA Select cell Example 2-2

Place a cursor in the different cells and run this code to see how it selects cell A1.

VBA Select cell Example 2-3

Example #3 – Insert Values to Cells

After selecting the cell, what do we usually do?

We perform some action. One action is to enter some value. We can enter the value in two ways. One is again using the RANGE object or uses the object ActiveCell,

To insert a value using the RANGE object, refer to cell A1 by using RANGE.

VBA Select cell Example 3

This time we are inserting the value, so select VALUE property.

Code:

Sub Macro1()

Range("A1").Select
Range("A1").Value

End Sub

VBA Select cell Example 3-1

To insert a value, put an equal sign and enter your value in double quotes if the value is text. If the value is numeric, you can directly enter the value.

Code:

Sub Macro1()

Range("A1").Select
Range("A1").Value = "Hello"

End Sub

Example 3-2

Now, press the F8 key to run the code line-by-line to understand the line of codes. For example, the first press of the F8 key will highlight the Macro name with yellow before this select B2 cell.

Upon pressing the F8 key one more time, it should insert the value “Hello” to cell A1.

Example 3-3

We can also insert the value by using the Active Cell method.

The moment we select the cell, it becomes an active cell. So, use the Property Active cell to insert the value.

Example 3-4

It is also the same as the last one. Using a range object makes it “explicit,” and using active cells makes it “Implicit.”

Example #4 – Select More than one Cell

We can also select multiple cells at a time. We need to specify the range of cells to select in double quotes. If you want to select cells from A1 to A5, below is the way.

Code:

Sub Macro2()

Range("A1:A5").Select

End Sub

Example 4

Run this code using the F5 key or manually to show the result.

Example 4-1

We can also select noncontiguous cells with a range object. So, for example, you can do this if you want to select cells from A1 to A5, C1 to C5, or E5 cells.

Code:

Sub Macro3()

Range("A1:A5,C1:C5,E5").Select

End Sub

Example 4-2

Run this code manually or through the F5 key to show the result.

Example 4-2

We need to start the double quote before we specify any cell and then close after the last cell.

Not only cells, but we can also select the named ranges by using the range’s name.

Example #5 – Select cells by using CELLS Property

Not through the RANGE object but also the CELLS property, we can select the cells.

VBA Cells

In the CELLS property, we need to specify the row and column numbers we select. Unlike a range method, we used A1, A5, C5, and C10 as references.

For example, CELLS (1,1) means A1 cell, and CELLS (2,5) means E2 cell. Like this, we can select the cells.

Code:

Sub Macro4()

Cells(2, 3).Select

End Sub

Example 4-3

Recommended Articles

This article has been a guide to VBA Select Cell. Here, we learn how to select an Excel cell using VBA code, practical examples, and a downloadable template. Below you can find some useful Excel VBA articles: –

  • VBA Range Cells
  • What are Clear Contents in Excel VBA?
  • Text Box in VBA
  • Do Until Loop in VBA

When working with Excel, most of your time is spent in the worksheet area – dealing with cells and ranges.

And if you want to automate your work in Excel using VBA, you need to know how to work with cells and ranges using VBA.

There are a lot of different things you can do with ranges in VBA (such as select, copy, move, edit, etc.).

So to cover this topic, I will break this tutorial into sections and show you how to work with cells and ranges in Excel VBA using examples.

Let’s get started.

All the codes I mention in this tutorial need to be placed in the VB Editor. Go to the ‘Where to Put the VBA Code‘ section to know how it works.

If you’re interested in learning VBA the easy way, check out my Online Excel VBA Training.

Selecting a Cell / Range in Excel using VBA

To work with cells and ranges in Excel using VBA, you don’t need to select it.

In most of the cases, you are better off not selecting cells or ranges (as we will see).

Despite that, it’s important you go through this section and understand how it works. This will be crucial in your VBA learning and a lot of concepts covered here will be used throughout this tutorial.

So let’s start with a very simple example.

Selecting a Single Cell Using VBA

If you want to select a single cell in the active sheet (say A1), then you can use the below code:

Sub SelectCell()
Range("A1").Select
End Sub

The above code has the mandatory ‘Sub’ and ‘End Sub’ part, and a line of code that selects cell A1.

Range(“A1”) tells VBA the address of the cell that we want to refer to.

Select is a method of the Range object and selects the cells/range specified in the Range object. The cell references need to be enclosed in double quotes.

This code would show an error in case a chart sheet is an active sheet. A chart sheet contains charts and is not widely used. Since it doesn’t have cells/ranges in it, the above code can’t select it and would end up showing an error.

Note that since you want to select the cell in the active sheet, you just need to specify the cell address.

But if you want to select the cell in another sheet (let’s say Sheet2), you need to first activate Sheet2 and then select the cell in it.

Sub SelectCell()
Worksheets("Sheet2").Activate
Range("A1").Select
End Sub

Similarly, you can also activate a workbook, then activate a specific worksheet in it, and then select a cell.

Sub SelectCell()
Workbooks("Book2.xlsx").Worksheets("Sheet2").Activate
Range("A1").Select
End Sub

Note that when you refer to workbooks, you need to use the full name along with the file extension (.xlsx in the above code). In case the workbook has never been saved, you don’t need to use the file extension.

Now, these examples are not very useful, but you will see later in this tutorial how we can use the same concepts to copy and paste cells in Excel (using VBA).

Just as we select a cell, we can also select a range.

In case of a range, it could be a fixed size range or a variable size range.

In a fixed size range, you would know how big the range is and you can use the exact size in your VBA code. But with a variable-sized range, you have no idea how big the range is and you need to use a little bit of VBA magic.

Let’s see how to do this.

Selecting a Fix Sized Range

Here is the code that will select the range A1:D20.

Sub SelectRange()
Range("A1:D20").Select
End Sub

Another way of doing this is using the below code:

Sub SelectRange()
Range("A1", "D20").Select
End Sub

The above code takes the top-left cell address (A1) and the bottom-right cell address (D20) and selects the entire range. This technique becomes useful when you’re working with variably sized ranges (as we will see when the End property is covered later in this tutorial).

If you want the selection to happen in a different workbook or a different worksheet, then you need to tell VBA the exact names of these objects.

For example, the below code would select the range A1:D20 in Sheet2 worksheet in the Book2 workbook.

Sub SelectRange()
Workbooks("Book2.xlsx").Worksheets("Sheet1").Activate
Range("A1:D20").Select
End Sub

Now, what if you don’t know how many rows are there. What if you want to select all the cells that have a value in it.

In these cases, you need to use the methods shown in the next section (on selecting variably sized range).

Selecting a Variably Sized Range

There are different ways you can select a range of cells. The method you choose would depend on how the data is structured.

In this section, I will cover some useful techniques that are really useful when you work with ranges in VBA.  

Select Using CurrentRange Property

In cases where you don’t know how many rows/columns have the data, you can use the CurrentRange property of the Range object.

The CurrentRange property covers all the contiguous filled cells in a data range.

Below is the code that will select the current region that holds cell A1.

Sub SelectCurrentRegion()
Range("A1").CurrentRegion.Select
End Sub

The above method is good when you have all data as a table without any blank rows/columns in it.

Cells and Ranges in VBA - currentregion property

But in case you have blank rows/columns in your data, it will not select the ones after the blank rows/columns. In the image below, the CurrentRegion code selects data till row 10 as row 11 is blank.

Cells and Ranges in VBA - currentregion property not selecting rows after blank

In such cases, you may want to use the UsedRange property of the Worksheet Object.

Select Using UsedRange Property

UsedRange allows you to refer to any cells that have been changed.

So the below code would select all the used cells in the active sheet.

Sub SelectUsedRegion()
ActiveSheet.UsedRange.Select
End Sub

Note that in case you have a far-off cell that has been used, it would be considered by the above code and all the cells till that used cell would be selected.

Select Using the End Property

Now, this part is really useful.

The End property allows you to select the last filled cell. This allows you to mimic the effect of Control Down/Up arrow key or Control Right/Left keys.

Let’s try and understand this using an example.

Suppose you have a dataset as shown below and you want to quickly select the last filled cells in column A.

The problem here is that data can change and you don’t know how many cells are filled. If you have to do this using keyboard, you can select cell A1, and then use Control + Down arrow key, and it will select the last filled cell in the column.

Now let’s see how to do this using VBA. This technique comes in handy when you want to quickly jump to the last filled cell in a variably-sized column

Sub GoToLastFilledCell()
Range("A1").End(xlDown).Select
End Sub

The above code would jump to the last filled cell in column A.

Similarly, you can use the End(xlToRight) to jump to the last filled cell in a row.

Sub GoToLastFilledCell()
Range("A1").End(xlToRight).Select
End Sub

Now, what if you want to select the entire column instead of jumping to the last filled cell.

You can do that using the code below:

Sub SelectFilledCells()
Range("A1", Range("A1").End(xlDown)).Select
End Sub

In the above code, we have used the first and the last reference of the cell that we need to select. No matter how many filled cells are there, the above code will select all.

Remember the example above where we selected the range A1:D20 by using the following line of code:

Range(“A1″,”D20”)

Here A1 was the top-left cell and D20 was the bottom-right cell in the range. We can use the same logic in selecting variably sized ranges. But since we don’t know the exact address of the bottom-right cell, we used the End property to get it.

In Range(“A1”, Range(“A1”).End(xlDown)), “A1” refers to the first cell and Range(“A1”).End(xlDown) refers to the last cell. Since we have provided both the references, the Select method selects all the cells between these two references.

Similarly, you can also select an entire data set that has multiple rows and columns.

The below code would select all the filled rows/columns starting from cell A1.

Sub SelectFilledCells()
Range("A1", Range("A1").End(xlDown).End(xlToRight)).Select
End Sub

In the above code, we have used Range(“A1”).End(xlDown).End(xlToRight) to get the reference of the bottom-right filled cell of the dataset.

Difference between Using CurrentRegion and End

If you’re wondering why use the End property to select the filled range when we have the CurrentRegion property, let me tell you the difference.

With End property, you can specify the start cell. For example, if you have your data in A1:D20, but the first row are headers, you can use the End property to select the data without the headers (using the code below).

Sub SelectFilledCells()
Range("A2", Range("A2").End(xlDown).End(xlToRight)).Select
End Sub

But the CurrentRegion would automatically select the entire dataset, including the headers.

So far in this tutorial, we have seen how to refer to a range of cells using different ways.

Now let’s see some ways where we can actually use these techniques to get some work done.

Copy Cells / Ranges Using VBA

As I mentioned at the beginning of this tutorial, selecting a cell is not necessary to perform actions on it. You will see in this section how to copy cells and ranges without even selecting these.

Let’s start with a simple example.

Copying Single Cell

If you want to copy cell A1 and paste it into cell D1, the below code would do it.

Sub CopyCell()
Range("A1").Copy Range("D1")
End Sub

Note that the copy method of the range object copies the cell (just like Control +C) and pastes it in the specified destination.

In the above example code, the destination is specified in the same line where you use the Copy method. If you want to make your code even more readable, you can use the below code:

Sub CopyCell()
Range("A1").Copy Destination:=Range("D1")
End Sub

The above codes will copy and paste the value as well as formatting/formulas in it.

As you might have already noticed, the above code copies the cell without selecting it. No matter where you’re on the worksheet, the code will copy cell A1 and paste it on D1.

Also, note that the above code would overwrite any existing code in cell D2. If you want Excel to let you know if there is already something in cell D1 without overwriting it, you can use the code below.

Sub CopyCell()
If Range("D1") <> "" Then
Response = MsgBox("Do you want to overwrite the existing data", vbYesNo)
End If
If Response = vbYes Then
Range("A1").Copy Range("D1")
End If
End Sub

Copying a Fix Sized Range

If you want to copy A1:D20 in J1:M20, you can use the below code:

Sub CopyRange()
Range("A1:D20").Copy Range("J1")
End Sub

In the destination cell, you just need to specify the address of the top-left cell. The code would automatically copy the exact copied range into the destination.

You can use the same construct to copy data from one sheet to the other.

The below code would copy A1:D20 from the active sheet to Sheet2.

Sub CopyRange()
Range("A1:D20").Copy Worksheets("Sheet2").Range("A1")
End Sub

The above copies the data from the active sheet. So make sure the sheet that has the data is the active sheet before running the code. To be safe, you can also specify the worksheet’s name while copying the data.

Sub CopyRange()
Worksheets("Sheet1").Range("A1:D20").Copy Worksheets("Sheet2").Range("A1")
End Sub

The good thing about the above code is that no matter which sheet is active, it will always copy the data from Sheet1 and paste it in Sheet2.

You can also copy a named range by using its name instead of the reference.

For example, if you have a named range called ‘SalesData’, you can use the below code to copy this data to Sheet2.

Sub CopyRange()
Range("SalesData").Copy Worksheets("Sheet2").Range("A1")
End Sub

If the scope of the named range is the entire workbook, you don’t need to be on the sheet that has the named range to run this code. Since the named range is scoped for the workbook, you can access it from any sheet using this code.

If you have a table with the name Table1, you can use the below code to copy it to Sheet2.

Sub CopyTable()
Range("Table1[#All]").Copy Worksheets("Sheet2").Range("A1")
End Sub

You can also copy a range to another Workbook.

In the following example, I copy the Excel table (Table1), into the Book2 workbook.

Sub CopyCurrentRegion()
Range("Table1[#All]").Copy Workbooks("Book2.xlsx").Worksheets("Sheet1").Range("A1")
End Sub

This code would work only if the Workbook is already open.

Copying a Variable Sized Range

One way to copy variable sized ranges is to convert these into named ranges or Excel Table and the use the codes as shown in the previous section.

But if you can’t do that, you can use the CurrentRegion or the End property of the range object.

The below code would copy the current region in the active sheet and paste it in Sheet2.

Sub CopyCurrentRegion()
Range("A1").CurrentRegion.Copy Worksheets("Sheet2").Range("A1")
End Sub

If you want to copy the first column of your data set till the last filled cell and paste it in Sheet2, you can use the below code:

Sub CopyCurrentRegion()
Range("A1", Range("A1").End(xlDown)).Copy Worksheets("Sheet2").Range("A1")
End Sub

If you want to copy the rows as well as columns, you can use the below code:

Sub CopyCurrentRegion()
Range("A1", Range("A1").End(xlDown).End(xlToRight)).Copy Worksheets("Sheet2").Range("A1")
End Sub

Note that all these codes don’t select the cells while getting executed. In general, you will find only a handful of cases where you actually need to select a cell/range before working on it.

Assigning Ranges to Object Variables

So far, we have been using the full address of the cells (such as Workbooks(“Book2.xlsx”).Worksheets(“Sheet1”).Range(“A1”)).

To make your code more manageable, you can assign these ranges to object variables and then use those variables.

For example, in the below code, I have assigned the source and destination range to object variables and then used these variables to copy data from one range to the other.

Sub CopyRange()
Dim SourceRange As Range
Dim DestinationRange As Range
Set SourceRange = Worksheets("Sheet1").Range("A1:D20")
Set DestinationRange = Worksheets("Sheet2").Range("A1")
SourceRange.Copy DestinationRange
End Sub

We start by declaring the variables as Range objects. Then we assign the range to these variables using the Set statement. Once the range has been assigned to the variable, you can simply use the variable.

Enter Data in the Next Empty Cell (Using Input Box)

You can use the Input boxes to allow the user to enter the data.

For example, suppose you have the data set below and you want to enter the sales record, you can use the input box in VBA. Using a code, we can make sure that it fills the data in the next blank row.

Sub EnterData()
Dim RefRange As Range
Set RefRange = Range("A1").End(xlDown).Offset(1, 0)
Set ProductCategory = RefRange.Offset(0, 1)
Set Quantity = RefRange.Offset(0, 2)
Set Amount = RefRange.Offset(0, 3)
RefRange.Value = RefRange.Offset(-1, 0).Value + 1
ProductCategory.Value = InputBox("Product Category")
Quantity.Value = InputBox("Quantity")
Amount.Value = InputBox("Amount")
End Sub

The above code uses the VBA Input box to get the inputs from the user, and then enters the inputs into the specified cells.

Note that we didn’t use exact cell references. Instead, we have used the End and Offset property to find the last empty cell and fill the data in it.

This code is far from usable. For example, if you enter a text string when the input box asks for quantity or amount, you will notice that Excel allows it. You can use an If condition to check whether the value is numeric or not and then allow it accordingly.

Looping Through Cells / Ranges

So far we can have seen how to select, copy, and enter the data in cells and ranges.

In this section, we will see how to loop through a set of cells/rows/columns in a range. This could be useful when you want to analyze each cell and perform some action based on it.

For example, if you want to highlight every third row in the selection, then you need to loop through and check for the row number. Similarly, if you want to highlight all the negative cells by changing the font color to red, you need to loop through and analyze each cell’s value.

Here is the code that will loop through the rows in the selected cells and highlight alternate rows.

Sub HighlightAlternateRows()
Dim Myrange As Range
Dim Myrow As Range
Set Myrange = Selection
For Each Myrow In Myrange.Rows
If Myrow.Row Mod 2 = 0 Then
Myrow.Interior.Color = vbCyan
End If
Next Myrow
End Sub

The above code uses the MOD function to check the row number in the selection. If the row number is even, it gets highlighted in cyan color.

Here is another example where the code goes through each cell and highlights the cells that have a negative value in it.

Sub HighlightAlternateRows()
Dim Myrange As Range
Dim Mycell As Range
Set Myrange = Selection
For Each Mycell In Myrange
If Mycell < 0 Then
Mycell.Interior.Color = vbRed
End If
Next Mycell
End Sub

Note that you can do the same thing using Conditional Formatting (which is dynamic and a better way to do this). This example is only for the purpose of showing you how looping works with cells and ranges in VBA.

Where to Put the VBA Code

Wondering where the VBA code goes in your Excel workbook?

Excel has a VBA backend called the VBA editor. You need to copy and paste the code in the VB Editor module code window.

Here are the steps to do this:

  1. Go to the Developer tab.vba cells and ranges - Developer Tab in ribbon
  2. Click on the Visual Basic option. This will open the VB editor in the backend.Click on Visual Basic
  3. In the Project Explorer pane in the VB Editor, right-click on any object for the workbook in which you want to insert the code. If you don’t see the Project Explorer, go to the View tab and click on Project Explorer.
  4. Go to Insert and click on Module. This will insert a module object for your workbook.Cells and Ranges in VBA - Module
  5. Copy and paste the code in the module window.Cells and Ranges in VBA - code paste

You May Also Like the Following Excel Tutorials:

  • Working with Worksheets using VBA.
  • Working with Workbooks using VBA.
  • Creating User-Defined Functions in Excel.
  • For Next Loop in Excel VBA – A Beginner’s Guide with Examples.
  • How to Use Excel VBA InStr Function (with practical EXAMPLES).
  • Excel VBA Msgbox.
  • How to Record a Macro in Excel.
  • How to Run a Macro in Excel.
  • How to Create an Add-in in Excel.
  • Excel Personal Macro Workbook | Save & Use Macros in All Workbooks.
  • Excel VBA Events – An Easy (and Complete) Guide.
  • Excel VBA Error Handling.
  • How to Sort Data in Excel using VBA (A Step-by-Step Guide).
  • 24 Useful Excel Macro Examples for VBA Beginners (Ready-to-use).

I put comments in the code so it should be really easy to understand.

Run the below code first

Sub Main()

    Dim i As Long ' row variable
    Dim e As Long ' column variable

    i = 3 ' row 3
    e = 13 ' column 13 ("M")

    ' this will put: Cells(3,13) in Range "M3"
    Cells(i, e) = "Cells(" & i & ", " & e & ")"


    ' if you want to offset the current active cell then
    ' use Offset(x, y)

    '  use negative x to offset up
    Cells(i, e).Offset(-1, 0) = "1 up"

    '  use positive x to offset down
    Cells(i, e).Offset(1, 0) = "1 down"

    '  use negative y to offset left
    Cells(i, e).Offset(0, -1) = "1 left"

    '  use positive y to offset right
    Cells(i, e).Offset(0, 1) = "1 right"


    ' same principles apply when using range object
    Dim r As Range
    Set r = Cells(i, e)

    r.Offset(-2, 0) = "2 up"
    r.Offset(2, 0) = "2 down"
    r.Offset(0, -2) = "2 left"
    r.Offset(0, 2) = "2 right"

    Columns.AutoFit
End Sub

then look at your sheet and analyse what command does what :)

enter image description here


Download Article


Download Article

This wikiHow teaches you how to start using Visual Basic procedures to select data in Microsoft Excel. As long as you’re familiar with basic VB scripting and using more advanced features of Excel, you’ll find the selection process pretty straight-forward.

  1. 1

    Select one cell on the current worksheet. Let’s say you want to select cell E6 with Visual Basic. You can do this with either of the following options:[1]

    ActiveSheet.Cells(6, 5).Select
    

    ActiveSheet.Range("E6").Select
    
  2. 2

    Select one cell on a different worksheet in the same workbook. Let’s say our example cell, E6, is on a sheet called Sheet2. You can use either of the following options to select it:

    Application.Goto ActiveWorkbook.Sheets("Sheet2").Cells(6, 5)
    
    Application.Goto (ActiveWorkbook.Sheets("Sheet2").Range("E6"))
    

    Advertisement

  3. 3

    Select one cell on a worksheet in a different workbook. Let’s say you want to select a cell from Sheet1 in a workbook called BOOK2.XLS. Either of these two options should do the trick:

    Application.Goto Workbooks("BOOK2.XLS").Sheets("Sheet1").Cells(2,1)
    
    Application.Goto Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("A2")
    
  4. 4

    Select a cell relative to another cell. You can use VB to select a cell based on its location relative to the active (or a different) cell. Just be sure the cell exists to avoid errors. Here’s how to use :

    • Select the cell three rows below and four columns to the left of the active cell:

      ActiveCell.Offset(3, -4).Select
      
    • Select the cell five rows below and four columns to the right of cell C7:

      ActiveSheet.Cells(7, 3).Offset(5, 4).Select
      
  5. Advertisement

  1. 1

    Select a range of cells on the active worksheet. If you wanted to select cells C1:D6 on the current sheet, you can enter any of the following three examples:

    ActiveSheet.Range(Cells(1, 3), Cells(6, 4)).Select
    
    ActiveSheet.Range("C1:D6").Select
    
    ActiveSheet.Range("C1", "D6").Select
    
  2. 2

    Select a range from another worksheet in the same workbook. You could use either of these examples to select cells C3:E11 on a sheet called Sheet3:

    Application.Goto ActiveWorkbook.Sheets("Sheet3").Range("C3:E11")
    
    Application.Goto ActiveWorkbook.Sheets("Sheet3").Range("C3", "E11")
    
  3. 3

    Select a range of cells from a worksheet in a different workbook. Both of these examples would select cells E12:F12 on Sheet1 of a workbook called BOOK2.XLS:

    Application.Goto Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("E12:F12")
    
    Application.Goto Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("E12", "F12")
    
  4. 4

    Select a named range. If you’ve assigned a name to a range of cells, you’d use the same syntax as steps 4-6, but you’d replace the range address (e.g., «E12», «F12») with the range’s name (e.g., «Sales»). Here are some examples:

    • On the active sheet:

      ActiveSheet.Range("Sales").Select
      
    • Different sheet of same workbook:

      Application.Goto ActiveWorkbook.Sheets("Sheet3").Range("Sales")
      
    • Different workbook:

      Application.Goto Workbooks("BOOK2.XLS").Sheets("Sheet1").Range("Sales")
      
  5. 5

    Select a range relative to a named range. The syntax varies depending on the named range’s location and whether you want to adjust the size of the new range.

    • If the range you want to select is the same size as one called Test5 but is shifted four rows down and three columns to the right, you’d use:
      ActiveSheet.Range("Test5").Offset(4, 3).Select
      
    • If the range is on Sheet3 of the same workbook, activate that worksheet first, and then select the range like this:
      Sheets("Sheet3").Activate ActiveSheet.Range("Test").Offset(4, 3).Select
      
  6. 6

    Select a range and resize the selection. You can increase the size of a selected range if you need to. If you wanted to select a range called Database’ and then increase its size by 5 rows, you’d use this syntax:

    Range("Database").Select Selection.Resize(Selection.Rows.Count + 5, _Selection.Columns.Count).Select
    
  7. 7

    Select the union of two named ranges. If you have two overlapping named ranges, you can use VB to select the cells in that overlapping area (called the «union»). The limitation is that you can only do this on the active sheet. Let’s say you want to select the union of a range called Great and one called Terrible:

    • Application.Union(Range("Great"), Range("Terrible")).Select
      
    • If you want to select the intersection of two named ranges instead of the overlapping area, just replace Application.Union with Application.Intersect.
  8. Advertisement

  1. 1

    Use this example data for the examples in this method. This chart full of example data, courtesy of Microsoft, will help you visualize how the examples behave:[2]

    A1: Name B1: Sales C1: Quantity
    A2: a B2: $10 C2: 5
    A3: b B3: C3: 10
    A4: c B4: $10 C4: 5
    A5: B5: C5:
    A6: Total B6: $20 C6: 20
  2. 2

    Select the last cell at the bottom of a contiguous column. The following example will select cell A4:

    ActiveSheet.Range("A1").End(xlDown).Select
    
  3. 3

    Select the first blank cell below a column of contiguous cells. The following example will select A5 based on the chart above:

    ActiveSheet.Range("A1").End(xlDown).Offset(1,0).Select
    
  4. 4

    Select a range of continuous cells in a column. Both of the following examples will select the range A1:A4:

    ActiveSheet.Range("A1", ActiveSheet.Range("a1").End(xlDown)).Select
    
    ActiveSheet.Range("A1:" & ActiveSheet.Range("A1"). End(xlDown).Address).Select
    
  5. 5

    Select a whole range of non-contiguous cells in a column. Using the data table at the top of this method, both of the following examples will select A1:A6:

    ActiveSheet.Range("A1",ActiveSheet.Range("A65536").End(xlUp)).Select
    
    ActiveSheet.Range("A1",ActiveSheet.Range("A65536").End(xlUp)).Select
    
  6. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

  • The «ActiveSheet» and «ActiveWorkbook» properties can usually be omitted if the active sheet and/or workbook(s) are implied.

Thanks for submitting a tip for review!

Advertisement

About This Article

Article SummaryX

1. Use ActiveSheet.Range(«E6»).Select to select E6 on the active sheet.
2. Use Application.Goto (ActiveWorkbook.Sheets(«Sheet2»).Range(«E6»)) to select E6 on Sheet2.
3. Add Workbooks(«BOOK2.XLS») to the last step to specify that the sheet is in BOOK2.XLS.

Did this summary help you?

Thanks to all authors for creating a page that has been read 167,714 times.

Is this article up to date?

Key Notes

  • You can use the Range property as well as Cells property to use the Select property to select a range.

Select a Single Cell

To select a single cell, you need to define the cell address using the range, and then you need to use the select property. Let’s say if you want to select cell A1, the code would be:

Range("A1").Select

And if you want to use the CELLS, in that case, the code would be:

Cells(1,1).Select

Select a Range of Cells

To select an entire range, you need to define the address of the range and then use the select property. For example, if you want to select the range A1 to A10, the code would be:

Range("A1:A10").Select

Select Non-Continues Range

To select a non-continuous range, you need to use a comma within the cell or range addresses, and then use the select the property. Let’s say if you want to select the range A1 to A10 and C5 to C10, the code would be:

Range("A1:A10, C5:C10").Select

And if you want to select single cells that are non-continuous, the code would be:

Range("A1, A5, A9").Select

Select a Column

To select a column, let’s say column A, you need to write code like the following:

Range("A:A").Select

And if you want to select multiple columns, in that case, the code would be like the following:

Range("A:C").Select
Range("A:A, C:C").Select

Select a Row

In the same way, if you want to select a row, let’s say row five, the code would be like the following.

Range("5:5").Select

And for multiple rows, the code would be:

Range("1:5").Select
Range("1:1, 3:3").Select

Select All the Cells of a Worksheet

Let’s say you want to select all the cells in the worksheet, just like you use the keyboard shortcut Control +A. You need to use the following code.

ActiveSheet.Cells.Select
Cells.Select

“Cells” refer to all the cells in the worksheet, and then select property selects them.

Select Cells with Data Only

Here “Cells with Data” only mean a section in the worksheet where cells have data and you can use the following code.

ActiveSheet.UsedRange.Select

Select a Named Range

If you have a named range, you can select it by using its name.

Range("my_range").Select

In the above code, you have the “my_range” named range and then the select property, and when you run this macro, it selects the specified range.

Select an Excel Table

If you work with Excel tables, you can also select them using the select property. Let’s say you have a table with the name “Data”, then the code to select that table would be:

If you want to select a column instead of the entire table, then the code would be, like the following:

Range("Data[Amount]").Select

And if you want to select the entire column including the header, then the code you can use:

Range("Data[[#All],[Amount]]").Select

You can also use the OFFSET property to select a cell or a range by navigating from a cell or a range. Let’s suppose you want to select a cell that is four columns right and five rows down from the A1; you can use the following code.

Range("A1").Offset(5, 4).Select

More Tutorials

    • Count Rows using VBA in Excel
    • Excel VBA Font (Color, Size, Type, and Bold)
    • Excel VBA Hide and Unhide a Column or a Row
    • Excel VBA Range – Working with Range and Cells in VBA
    • Apply Borders on a Cell using VBA in Excel
    • Find Last Row, Column, and Cell using VBA in Excel
    • Insert a Row using VBA in Excel
    • Merge Cells in Excel using a VBA Code
    • SELECT ALL the Cells in a Worksheet using a VBA Code
    • ActiveCell in VBA in Excel
    • Special Cells Method in VBA in Excel
    • UsedRange Property in VBA in Excel
    • VBA AutoFit (Rows, Column, or the Entire Worksheet)
    • VBA ClearContents (from a Cell, Range, or Entire Worksheet)
    • VBA Copy Range to Another Sheet + Workbook
    • VBA Enter Value in a Cell (Set, Get and Change)
    • VBA Insert Column (Single and Multiple)
    • VBA Named Range | (Static + from Selection + Dynamic)
    • VBA Range Offset
    • VBA Sort Range | (Descending, Multiple Columns, Sort Orientation
    • VBA Wrap Text (Cell, Range, and Entire Worksheet)
    • VBA Check IF a Cell is Empty + Multiple Cells

    ⇠ Back to What is VBA in Excel

    Helpful Links – Developer Tab – Visual Basic Editor – Run a Macro – Personal Macro Workbook – Excel Macro Recorder – VBA Interview Questions – VBA Codes

    Skip to content

    Select Cell Range in Excel VBA

    Description:

    If we want to deal with Cell or Range we can directly mention the object and change its properties or call its methods. We can also deal with Cells or Range by simply selecting it. Then we can use Selection object to refer Selected Cells, Range or any other Objects.

    We select cell range in Excel VBA to do particular task with the selection. For example we may want to change the background color of a range and we may want to change the font to Bold. In this case we do not required to loop each and every cell of the range to change the background color and font.

    Select Cell Range in Excel VBA – Solution:

    Select Cell Range in Excel VBA
    We can use Select method of Range or Cell to select it and do whatever you want to do.

    Select Cell Range in Excel VBA – Example:

    Following are the various examples which will show you how to select a range and perform some task.

    Example to Select a Cell

    In this example I am selecting a Cell using Select method of Cell.

    Sub sbSelectACell()
    
    'Selecting a Cell
    Cells(2, 3).Select 'This will select the Cell at 2nd row and 3rd column
    
    End Sub
    Example to Select a Range

    In this example I am selecting a Range using Select method of Range.

    Sub sbSelectARange()
    'You can also use Range Object
    Range("C3").Select
    
    'Collection of Cells OR Multiple Cells = Range
    Range ("B2:C4").Select ' It will Select B2,B3,B4,C2,C3,C4
    
    End Sub
    Example to Select a Range and change the background color

    In this example I am selecting the range from B2:C4 using Select method. And changing the background color to red using ColorIndex Property of Range.

    Sub sbSelectARangeandForamt()
    'Selecting a Range
    Range("B2:C4").Select  ' It will Select B2,B3,B4,C2,C3,C4
    Selection.Interior.ColorIndex = 3
    
    End Sub
    
    
    Instructions
    1. Open an Excel Workbook
    2. Press Alt+F11 to open VBA Editor
    3. Insert a Module from Insert Menu
    4. Copy the above code and Paste in the code window
    5. Save the file as macro enabled workbook
    6. Press F5 to execute it
    Effortlessly Manage Your Projects and Resources
    120+ Professional Project Management Templates!

    A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

    Save Up to 85% LIMITED TIME OFFER
    Excel VBA Project Management Templates
    All-in-One Pack
    120+ Project Management Templates
    Essential Pack
    50+ Project Management Templates

    Excel Pack
    50+ Excel PM Templates

    PowerPoint Pack
    50+ Excel PM Templates

    MS Word Pack
    25+ Word PM Templates

    Ultimate Project Management Template

    Ultimate Resource Management Template

    Project Portfolio Management Templates

    Related Posts

      • Description:
      • Select Cell Range in Excel VBA – Solution:
      • Select Cell Range in Excel VBA – Example:

    VBA Reference

    Effortlessly
    Manage Your Projects

    120+ Project Management Templates

    Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

    120+ PM Templates Includes:

    12 Comments

    1. Mukesh
      January 19, 2014 at 9:25 PM — Reply
    2. PNRao
      January 19, 2014 at 9:40 PM — Reply

      Hi Mekesh,

      Thanks for your feedback.

      Thanks-PNRao!

    3. bharat kumar
      June 23, 2014 at 1:33 PM — Reply

      Hello sir,
      i am very enthusiastic to learn vba so please guide me.i know some basics.I have seen many websites about this.I hope you are the best one to assist vba and i was so exiting while i have seen this site.I think you offered best vba module i have never seen before.I believe myself i am perfect in VBA under your guidelines.Thank you sir

    4. PNRao
      June 23, 2014 at 10:45 PM — Reply

      Hi Bharat,

      Thanks for showing interest to learn VBA! Yes, our goal is to provide the course with complete practical examples, instead of explaining only concepts. We committed to serve our customers with the best approach to make them experts in VBA, so that their satisfaction will help us to grow in this platform.

      Thank you-PNRao!

    5. Rohini
      July 1, 2014 at 8:51 PM — Reply

      Hello Sir, I have been going through your website for the past few weeks and it has tremendously helped with some of my codes. Although I have some experience in Access VBA, I have not used Excel VBA that much except to create some macros to help me do my job better. I work in data analysis for a public accounting firm and I find the examples very useful. Do you encourage asking specific questions (short) about vba code? Thanks for the excellent service you are doing for the Excel users community.

    6. PNRao
      July 1, 2014 at 9:31 PM — Reply

      Hi Rohini,

      Thanks for your feedback! You can feel free to ask questions regarding VBA or Excel. We are glad to know that our site is useful for Excel users. We are happy to help you by answering your questions.

      Thanks-PNRao!

    7. Girish
      September 11, 2014 at 10:53 AM — Reply

      Hi,

      I need your help to select rows from a report(row and column # are not fixed it gets changed frequently since these are filtered). Once we filter accordingly we are left with a range of info. Can u just help me out in this case..

    8. PNRao
      September 11, 2014 at 8:11 PM — Reply
    9. Girish
      September 12, 2014 at 8:52 AM — Reply

      Hi,

      I actually tried using the above codes prior asking u this. This however goes till it find a blank row/column. I actually need code the macro such that it checks the filtered data and deletes/copies the entire row. I m not sure how to crack this i m not familiar with loop iteration as well. So need your support on helping me out this.. . Thanks

    10. rajesh
      March 29, 2017 at 12:16 PM — Reply

      Hi,

      I just begin to learn VBA, I tried a code to copy data from specific cells in one workbook to some other workbooks, based on conditions.
      I used simple IF conditions for entire procedure. i need to copy this data every day. so I applied conditions based on date.
      now compiler is saying “Procedure is Too Long” .

      I want to know how to increment the cell with the help of a variable.
      Eg:
      day 1 data copied to E5
      day 2 data copied to E6

      Please suggest me, how to go ahead.

      Thanks
      Rajesh

    11. praveen singh
      September 8, 2017 at 8:50 AM — Reply

      How to use VBA codes for admission book?

    12. PNRao
      September 12, 2017 at 11:32 PM — Reply

      You can use to add new admissions in a specific range of cells. And you use VBA to perform calculation and print the results in Range.

      Please specify your requirement in detailed.
      Thanks!

    Effectively Manage Your
    Projects and  Resources

    With Our Professional and Premium Project Management Templates!

    ANALYSISTABS.COM provides free and premium project management tools, templates and dashboards for effectively managing the projects and analyzing the data.

    We’re a crew of professionals expertise in Excel VBA, Business Analysis, Project Management. We’re Sharing our map to Project success with innovative tools, templates, tutorials and tips.

    Project Management
    Excel VBA

    Download Free Excel 2007, 2010, 2013 Add-in for Creating Innovative Dashboards, Tools for Data Mining, Analysis, Visualization. Learn VBA for MS Excel, Word, PowerPoint, Access, Outlook to develop applications for retail, insurance, banking, finance, telecom, healthcare domains.

    Analysistabs Logo

    Page load link

    VBA Projects With Source Code

    3 Realtime VBA Projects
    with Source Code!

    Take Your Projects To The Next Level By Exploring Our Professional Projects

    Go to Top

    Like this post? Please share to your friends:
  • Select number vba word
  • Select line in word
  • Select language in word
  • Select in excel from row
  • Select function in word