VBA / find last Rows -columns
Posted: Wed Feb 20, 2019 1:24 pm
เรียน ท่านผู้รู้
หา row สุดท้ายที่มีการใส่ข้อมูล ได้ตำแหน่ง แถว
หา column สุดท้ายที่มีการใส่ข้อมูล ได้ตำแหน่ง ค่าของ columns ปรับแต่งสุตรแล้วค่าตัวแปร C ใน Msgbox ได้columns ไม่ตรง
"MsgBox "last row : " & Rows(r).Address(False) & vbNewLine & "last col : " & Columns(c).Address"
ช่วยแนะนำที่ครับ
หา row สุดท้ายที่มีการใส่ข้อมูล ได้ตำแหน่ง แถว
หา column สุดท้ายที่มีการใส่ข้อมูล ได้ตำแหน่ง ค่าของ columns ปรับแต่งสุตรแล้วค่าตัวแปร C ใน Msgbox ได้columns ไม่ตรง
"MsgBox "last row : " & Rows(r).Address(False) & vbNewLine & "last col : " & Columns(c).Address"
ช่วยแนะนำที่ครับ
Code: Select all
r = Cells.Find(What:="*", After:=[a1], LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row
c = Cells.Find(What:="*", After:=[a1], LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False).Columns
MsgBox "last row : " & Rows(r).Address(False) & vbNewLine & "last col : " & c