This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lastRow = Range("A" & Sheet1.Rows.Count).End(xlUp).Row | |
lastcol = Range("A" & Sheet1.Columns.Count).End(xlToLeft).Column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sheet1.Range("B2").CurrentRegion | |
Sheet1.Range("C5").CurrentRegion | |
Sheet1.Range("E9").CurrentRegion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub test() | |
Dim rg As Range, row As Range | |
Set rg = Sheet1.Range("B2").CurrentRegion | |
For Each row In rg.Rows | |
' in ra cửa sổ Immediate Window(Ctrl + G) | |
Debug.Print row.Cells(1, 1) | |
Next | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub test() | |
Dim i As Long | |
For i = 2 To rg.Rows.Count | |
'in ra cửa sổ Immediate Window(Ctrl + G) | |
Debug.Print rg.Cells(i, 1) | |
Next | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lấy toàn bộ các cột báo cáo | |
SELECT * FROM [A1:U42000] | |
SELECT [ORDER DATE], [ORDER QUANTITY], [SALES] FROM [A1:U42000] | |
SELECT [Order ID],[Order Date],[Order Quantity],[Order Priority] ,[Customer Name] FROM [A1:U42000] WHERE [Order Priority] = "High" | |
SELECT [Order ID],[Order Date],[Order Quantity],[Customer Name] FROM [A1:U42000] WHERE [Order Priority] = "High" AND [Customer Name] = "Annie Cyprus" | |
SELECT [Order ID],[Order Date],[Order Quantity],[Customer Name],[Ship Mode] FROM [A1:U42000] WHERE [Order Priority] = "High" AND [Ship Mode] LIKE "%Air" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub LastRowInOneColumn() | |
'Tìm dòng cuối cùng có dữ liệu trong cột A | |
Dim LastRow As Long | |
With ActiveSheet | |
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row | |
End With | |
MsgBox LastRow | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub LastColumnInOneRow() | |
'Find the last used column in a Row: row 1 in this example | |
Dim LastCol As Integer | |
With ActiveSheet | |
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column | |
End With | |
MsgBox LastCol | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Range_SpecialCells_Method() | |
MsgBox Range("A1").SpecialCells(xlCellTypeLastCell).Address | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Range_Find_Method() | |
'Finds the last non-blank cell on a sheet/range. | |
Dim lRow As Long | |
Dim lCol As Long | |
lRow = Cells.Find(What:="*", _ | |
After:=Range("A1"), _ | |
LookAt:=xlPart, _ | |
LookIn:=xlFormulas, _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub dem_so_sheets() | |
MsgBox "So sheet trong bang tinh nay la " & Application.Sheets.Count | |
End Sub |
OlderNewer