Nhờ các pác góp ý cho em vấn đề này.
Em lập file đọc số liệu (nội lực và tiết diện xuất từ Etabs), ko phát hiện thấy lỗi nhưng sao lại ko cho copy formulas hết cho các dòng. Cụ thể dòng này sao em thấy ko đc thực thi nhỉ "[E2].AutoFill Destination:=Range(Cells(2, "E"), Cells(n, "E")), Type:=xlFillDefault"
Nhờ Pác check giúp em. Thanks
-----------------------------
Private Sub nhapnoiluc_Click()
Dim n As Integer, m As Integer, q As Integer, p As Integer, i As Integer, S1 As Worksheet, S2 As Worksheet, S3 As Worksheet
'nhap noi luc'
Set S1 = Sheets("noi luc Etab")
Set S2 = Sheets("tinhthep")
Set S3 = Sheets("Frame Section Assignments")
If MsgBox("Ban Muon NHAP Du Lieu MOI?", vbOKCancel, "Canh Bao!!!") = vbCancel Then Exit Sub
n = 1
p = 41
Do While S1.Cells(n + 1, "A") <> ""
n = n + 1
p = p + 1
Loop
S2.Range("A42:K" & p).Clear
S2.Range("O42" & p).Clear
m = 1
Do While S1.Cells(m + 1, "A") <> ""
m = m + 1
Loop
S1.Range("A2" & m).Copy
S2.Select
[A42].PasteSpecial xlPasteValues
S1.Range("E2:J" & m).Copy
S2.Select
[F42].PasteSpecial xlPasteValues
'nhap tiet dien b, h cot'
'tiet dien tren sheet Frame section assigment va Frame Section Properties '
S3.Select
S3.Cells(2, "E").Select
ActiveCell.FormulaR1C1 = "=RC[-4]&RC[-3]"
n = 1
Do While Cells(n + 1, "A") <> ""
n = n + 1
Loop
S3.Cells(2, "E").Select
[E2].AutoFill Destination:=Range(Cells(2, "E"), Cells(n, "E")), Type:=xlFillDefault
Sheets("tinhthep").Select
Range("O42").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(VLOOKUP(RC[-14]&RC[-13],'Frame Section Assignments'!R2C5:R10000C9,2,0),'Frame Section Properties'!R2C1:R1000C9,8,0)*100"
Range("P42").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(VLOOKUP(RC[-15]&RC[-14],'Frame Section Assignments'!R2C5:R10000C9,2,0),'Frame Section Properties'!R2C1:R1000C9,7,0)*100"
'
End Sub
Em lập file đọc số liệu (nội lực và tiết diện xuất từ Etabs), ko phát hiện thấy lỗi nhưng sao lại ko cho copy formulas hết cho các dòng. Cụ thể dòng này sao em thấy ko đc thực thi nhỉ "[E2].AutoFill Destination:=Range(Cells(2, "E"), Cells(n, "E")), Type:=xlFillDefault"
Nhờ Pác check giúp em. Thanks
-----------------------------
Private Sub nhapnoiluc_Click()
Dim n As Integer, m As Integer, q As Integer, p As Integer, i As Integer, S1 As Worksheet, S2 As Worksheet, S3 As Worksheet
'nhap noi luc'
Set S1 = Sheets("noi luc Etab")
Set S2 = Sheets("tinhthep")
Set S3 = Sheets("Frame Section Assignments")
If MsgBox("Ban Muon NHAP Du Lieu MOI?", vbOKCancel, "Canh Bao!!!") = vbCancel Then Exit Sub
n = 1
p = 41
Do While S1.Cells(n + 1, "A") <> ""
n = n + 1
p = p + 1
Loop
S2.Range("A42:K" & p).Clear
S2.Range("O42" & p).Clear
m = 1
Do While S1.Cells(m + 1, "A") <> ""
m = m + 1
Loop
S1.Range("A2" & m).Copy
S2.Select
[A42].PasteSpecial xlPasteValues
S1.Range("E2:J" & m).Copy
S2.Select
[F42].PasteSpecial xlPasteValues
'nhap tiet dien b, h cot'
'tiet dien tren sheet Frame section assigment va Frame Section Properties '
S3.Select
S3.Cells(2, "E").Select
ActiveCell.FormulaR1C1 = "=RC[-4]&RC[-3]"
n = 1
Do While Cells(n + 1, "A") <> ""
n = n + 1
Loop
S3.Cells(2, "E").Select
[E2].AutoFill Destination:=Range(Cells(2, "E"), Cells(n, "E")), Type:=xlFillDefault
Sheets("tinhthep").Select
Range("O42").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(VLOOKUP(RC[-14]&RC[-13],'Frame Section Assignments'!R2C5:R10000C9,2,0),'Frame Section Properties'!R2C1:R1000C9,8,0)*100"
Range("P42").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(VLOOKUP(RC[-15]&RC[-14],'Frame Section Assignments'!R2C5:R10000C9,2,0),'Frame Section Properties'!R2C1:R1000C9,7,0)*100"
'
End Sub