Тёмный

Excel VBA VBA Grasping Row(s) and Columns(s) - CODE INCLUDED 

EverydayVBA
Подписаться 11 тыс.
Просмотров 1,8 тыс.
50% 1

**Get the Excel file here
chrisjterrell....
**Grab the Free VBA Quick Reference Guide
www.chrisjterr...
Excel VBA Graspoing Row(s)/Column(s) might be easier than you think once you grasp each one's purpose.
In this video, we compare the difference between rows/columns (with an "s") and row/column (without and "s"). When I first started using VBA, this was super confusing. As I grew in my mastery of VBA, the difference became more apparent. Row/column returns the index or number of the associated row or column on the Sheet. For example, row two is the first row on the Sheet, and Column two is equal to column "B" on the worksheet. Rows/columns are a reference to the parent object. Said another way, rows/columns are a subset of the existing Sheet or Range. You can do a lot with the referenced row(s)/column(s). In this video, we focus on selecting rows/columns and counting row/column
The code below is returning the count into a cell using the range.
'===================== CODE========================
Sub RowsColumns()
'Column is the property, Select is a methodSheet1.Rows(1).Select 'Rows is the property, Select is a method
Sheet1.Columns(1).Select 'reference the index one row at a time
Sheet1.Columns("A:J").Select 'reference multiple columns
Sheet1.Rows(1).Select 'reference the index one row at a time
Sheet1.Rows("1:10").Select 'reference multiple columns
Range("B20").Select
Range("B19") = ActiveCell.Address & " Active Cell"
Range("B20") = ActiveCell.Row
Range("B20") = ActiveCell.Column
Range("B19").CurrentRegion.ClearContents
Range("B20:G30").Select
Range("B19") = Selection.Address & " Selected Range"
Range("B20") = Range("B20:G30").Row & " Row in Range"
Range("B20") = Range("B20:G30").Column & " Column In Range"
Range("B19").CurrentRegion.ClearContents
Range("B20") = Range("B20:G30").Rows.Count & " Rows"
Range("B20") = Range("B20:G30").Columns.Count & " Columns"
Range("B20:G30").Rows(2).Select
Range("B20:G30").Columns(2).Select
End Sub

Опубликовано:

 

23 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@alializadeh8195
@alializadeh8195 2 года назад
Thanx
@nour-eddineoumakhlouf5296
@nour-eddineoumakhlouf5296 3 года назад
Good as cheat sheet!!
@EverydayVBAExcelTraining
@EverydayVBAExcelTraining 3 года назад
Thanks. I appreciate it
Далее
Please Help This Superhero! 🙏
00:48
Просмотров 4,4 млн
How to Use Arrays Instead of Ranges in Excel VBA
10:20
Просмотров 200 тыс.
Unbelievable methods to Selecting Rows in VBA
12:53
Просмотров 9 тыс.
Group Rows With Same Format Excel VBA Macro
5:17
Просмотров 7 тыс.
Will Python Kill Excel VBA?
12:39
Просмотров 339 тыс.