Topic
Những câu hỏi về code, xin giải thích các code... đã quá dài nên mình đóng nó lại và mở topic khác
Tất cả những bài viết liên quan đến việc nhờ
giải thích, xử lý và gỡ rối code VBA, các bạn vui lòng đăng tại đây!
Cảm ơn
Private Sub CommandButton1_Click()
Dim endR As Long
With Sheets("sheet2")
endR = .Range("B" & Rows.Count).End(xlUp).Row
.Range("B" & endR + 1) = tensanpham.Text
.Range("C" & endR + 1).Select
.Range("D" & endR + 1) = thanhphan.Text
.Range("E" & endR + 1) = luatuoisudung.Text
.Range("F" & endR + 1) = cachdung.Text
.Range("G" & endR + 1) = xuatxu.Text
.Range("H" & endR + 1) = hang.Text
.Range("I" & endR + 1) = mucdich.Text
End With
tensanpham.Text = ""
thanhphan.Text = ""
luatuoisudung.Text = ""
cachdung.Text = ""
xuatxu.Text = ""
hang.Text = ""
mucdich.Text = ""
Dim strfile As String
Dim rng As Range
Dim sh As Shape
Const cfile As String = "imagefiles(*.bmp;*.gif;*.jpg;*.jpeg;*.png),"
strfile = Application.GetOpenFilename(filefilter:=cfile, Title:=es)
If strfile = "false" Then
Else
Set rng = ActiveCell
Set rng = rng.MergeArea
With rng
Set sh = ActiveSheet.Shapes.AddPicture(Filename:=strfile, linktofile:=msoFalse, savewithdocument:=msoTrue, Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)
sh.LockAspectRatio = msoFalse
End With
Set sh = Nothing
Set rng = Nothing
End If
tensanpham.SetFocus
End Sub
mình bị báo lỗi như thế này bạn check hộ mình nhé