Code Lay Du Lieu

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Sub get_result()

Dim filedlg As FileDialog


Set filedlg = Application.FileDialog(msoFileDialogFilePicker)
With filedlg
.AllowMultiSelect = False
.Title = "CHON MAU CAN LAY KET QUA"
.InitialFileName = "C:\Chem32\1\DATA" & "\"
.Filters.Clear
'.Filters.Add "Excel", "*.xls?"
If .Show = True Then
docdulieu2 (.SelectedItems(1))
End If
End With
Set filedlg = Nothing
End Sub
Sub docdulieu2(duongdan As String)
Dim lstRow As Long
Dim wb_active As Workbook
Dim ws_active As Worksheet
Dim wb_close As Workbook
Dim ws_close As Worksheet
Dim samplename As String
Set wb_active = ActiveWorkbook
Application.ScreenUpdating = False
Set wb_close = Workbooks.Open(duongdan, True, True)

Set ws_close = wb_close.Sheets("Compound")


Set ws_active = wb_active.Sheets("Raw_result")
ws_close.Range("M:N").Copy Destination:=ws_active.Range("A:B")

Set ws_close = wb_close.Sheets(1)


Set ws_active = wb_active.Sheets("Raw_result")

ws_close.Range("B21").Copy Destination:=ws_active.Range("D1")
'---------------
wb_close.Close False
Set wb_close = Nothing
samplename = ws_active.Range("D1").Value
result = MsgBox("DAY LA KET QUA: " & samplename, 4, "KIEM TRA DUNG MAU CAN NHAP?")
If result = vbNo Then
MsgBox ("Chon lai")
Call get_result
End If
End Sub

You might also like