snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub Checkver()
Dim ws As Worksheet
Dim ul As String
Dim ky As String
ky = "1uAFl3HGeXzyS0vCR9shHQCoDYYMmsHfdktM3FNIdm9E"
ul = "https://spreadsheets.google.com/tq?tqx=out:html&key=" & ky
If ws("Main").Range("A1").Value < ul("Version").Range("A1") Then
MsgBox "ข้อมูลตรง"
Else
MsgBox "กรุณาปรับข้อมูลให้ตรงกัน!!!"
End If
End Sub
'https://docs.google.com/spreadsheets/d/1uAFl3HGeXzyS0vCR9shHQCoDYYMmsHfdktM3FNIdm9E/edit?usp=sharing
You do not have the required permissions to view the files attached to this post.
Sub Import_Sheets_to_Excel()
Dim QRT As QueryTable, ul As String, ky As String
With Worksheets("Main")
If .QueryTables.Count > 0 Then
.QueryTables(1).Delete
.Range("b1:b2").ClearContents
End If
ky = "1uAFl3HGeXzyS0vCR9shHQCoDYYMmsHfdktM3FNIdm9E"
ul = "https://spreadsheets.google.com/tq?tqx=out:html&key=" & ky
Set QRT = .QueryTables.Add(Connection:="URL;" & ul, Destination:=.Range("B1"))
QRT.Name = "GoogleSheetData"
QRT.FieldNames = True
QRT.RowNumbers = False
QRT.FillAdjacentFormulas = False
QRT.PreserveFormatting = True
QRT.RefreshOnFileOpen = False
QRT.BackgroundQuery = True
QRT.RefreshStyle = xlInsertDeleteCells
QRT.SavePassword = False
QRT.SaveData = True
QRT.AdjustColumnWidth = True
QRT.RefreshPeriod = 0
QRT.Refresh BackgroundQuery:=False
If .Range("A1").Value < .Range("b2") Then
MsgBox "ข้อมูลตรงกัน", vbExclamation
Else
MsgBox "กรุณาปรับข้อมูลให้ตรงกัน!!!", vbExclamation
End If
End With
End Sub
Sub Import_Sheets_to_Excel()
Dim QRT As QueryTable, ul As String, ky As String
With Worksheets("Main")
If .QueryTables.Count > 0 Then
.QueryTables(1).Delete
.Range("b1:b2").ClearContents
End If
ky = "1uAFl3HGeXzyS0vCR9shHQCoDYYMmsHfdktM3FNIdm9E"
ul = "https://spreadsheets.google.com/tq?tqx=out:html&key=" & ky
Set QRT = .QueryTables.Add(Connection:="URL;" & ul, Destination:=.Range("B1"))
QRT.Name = "GoogleSheetData"
QRT.FieldNames = True
QRT.RowNumbers = False
QRT.FillAdjacentFormulas = False
QRT.PreserveFormatting = True
QRT.RefreshOnFileOpen = False
QRT.BackgroundQuery = True
QRT.RefreshStyle = xlInsertDeleteCells
QRT.SavePassword = False
QRT.SaveData = True
QRT.AdjustColumnWidth = True
QRT.RefreshPeriod = 0
QRT.Refresh BackgroundQuery:=False
If .Range("A1").Value < .Range("b2") Then
MsgBox "ข้อมูลตรงกัน", vbExclamation
Else
MsgBox "กรุณาปรับข้อมูลให้ตรงกัน!!!", vbExclamation
End If
End With
End Sub