Hello,
I need help with this coding. I need Colum Aw to be formatted at Text. i tired this code Range("AW1:AW51").NumberFormat = "@"
10077890493189
I need help with this coding. I need Colum Aw to be formatted at Text. i tired this code Range("AW1:AW51").NumberFormat = "@"
10077890493189
VBA Code:
Sub ExportCSV()
Application.ScreenUpdating = False
Dim FlSv As Variant
Dim MyFile As String
Dim sh As Worksheet
Dim MyFileName As String
Dim DateString As String
DateString = Format(Now(), "yyyy-mm-dd_hh_mm_ss_AM/PM") '<~~ uses current time from computer clock down to the second
MyFileName = "Ohio Load #" & " " & DateString
Sheets("csv").Visible = True
Set sh = Sheets("csv")
sh.Copy
FlSv = Application.GetSaveAsFilename(MyFileName, fileFilter:="CSV (Comma delimited) (*.csv), *.csv", Title:="Where should we save this?")
If FlSv = False Then GoTo UserCancel Else GoTo UserOK
UserCancel: '<~~ this code is run if the user cancels out the file save dialog
ActiveWorkbook.Close (False)
MsgBox "****Export Canceled***"
Exit Sub
UserOK: '<~~ this code is run if user proceeds with saving the file (clicks the OK button)
MyFile = FlSv
With ActiveWorkbook
[COLOR=rgb(0, 0, 0)]Range("AW1:AW51").NumberFormat = "@"[/COLOR]
.SaveAs (MyFile), FileFormat:=xlCSV, CreateBackup:=False
.Close False
MsgBox "Export Completed!!"
End With
Sheets("csv").Visible = False
Application.ScreenUpdating = True
End Sub