Skip to content

Instantly share code, notes, and snippets.

@DuongAQ
Created March 20, 2018 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuongAQ/8d621eb051d860a0ec2e1b052751c486 to your computer and use it in GitHub Desktop.
Save DuongAQ/8d621eb051d860a0ec2e1b052751c486 to your computer and use it in GitHub Desktop.
Sub Phan_mang_Dat_Cong_thuc() 'Đặt công thức cho các mảng bị phân tách
Dim lr As Long
Dim area As Range
Dim sh As Worksheet
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
'Cột thành tiền (cột E) nhân 10% thuế để ra kết quả tại cột F
For Each area In sh.Range("E2:E" & lr).SpecialCells(xlCellTypeFormulas).Areas
area.Offset(, 1).FormulaR1C1 = "=RC[-1]*10%" 'Cột F cách cột E 1 cột nên Offset(,1)
'RC[-1] để lấy cột trước cột kết quả 1 cột
Next area
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment