Mở file Excel, bấm Atl+F11 >> Chọn menu Insert>Module dán dòng code dưới đây vào
Public Function FMT$(ByVal Value, ByVal strFormat)
FMT = VBA.Format$(Value, strFormat)
End Function
Đóng cửa sổ VBA, thêm cột fix định dạng và dùng hàm FMT đã tạo ở trên theo công thức =FMT(A1, "dd/mm/yyyy") hoặc bất kỳ định dạng nào khác mong muốn, trong đó A1 là cell tham chiếu gốc. Sau khi fix thì dù cột gốc có dùng định dạng nào, cột fix vẫn không bị đổi định dạng.
Nguồn: https://superuser.com/questions/730371/how-to-prevent-excel-to-use-the-os-regional-settings-for-date-patterns-in-formul
No comments:
Post a Comment