VBA เซฟไฟล์ใหม่เอาเฉพาะ TEXT ไม่เอา formula
Posted: Thu Mar 09, 2023 10:50 am
Code: Select all
Dim ws As Worksheet, SaveToDirectory As String
SaveToDirectory = "D:\size\"
Application.DisplayAlerts = False
ThisWorkbook.Worksheets("vlookup").Copy
With ActiveWorkbook
Range("a1").Value = "columna"
Range("b1").Value = "columnb"
Range("c1").Value = "columnc"
Range("d1").Value = "columnd"
Range("e1").Value = "columne"
Range("f1").Value = "columnf"
Range("g1").Value = "columng"
Range("h1").Value = "columnh"
Range("i1").Value = "columni"
Range("j1").Value = "columnj"
Range("k1").Value = "columnk"
Range("l1").Value = "columnl"
Range("m1").Value = "columnm"
Range("n1").Value = "columnn"
Range("o1").Value = "columno"
Range("p1").Value = "columnp"
Range("q1").Value = "columnq"
Range("r1").Value = "columnr"
Range("s1").Value = "columns"
Range("t1").Value = "columnt"
Range("u1").Value = "columnu"
.Sheets("vlookup").Range("a2:a4").EntireRow.Delete shift:=xlUp
.SaveAs Filename:=SaveToDirectory & .Sheets("vlookup").Name & ".xls", FileFormat:=xlExcel8, CreateBackup:=False
.Close SaveChanges:=True
End With
Application.DisplayAlerts = True
End Sub