I am using the following macro to convert text to numbers for all the values.
Since linked server is loading the xls, the format got messed up.
Columns are already formatted e.g, accounting, percentage, number….etc, but even though
everything are saved as text.
So I decided to run the macro before closiong the workbook.
The macros goes like this:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cells.Select
Range("D1").Activate
Cells.SpecialCells(xlCellTypeLastCell).Offset(1, 1).Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlPasteSpecialOperationAdd
With Selection
.VerticalAlignment = xlTop
.WrapText = False
End With
ActiveWorkbook.SaveAs "test.xls"
ActiveWorkbook.Close
End Sub
But the thing is, it pops up window to ask if I wanna save the changes,
How can I fix that.
Above macro takes little longer to execute!!!
I have fixed columns(till D1) but valiable rows.
Can somebody help me to figure this out.
Add in
ActiveWorkbook.Saved = TrueafterActiveWorkbook.SaveAs "test.xls". There are a few other options here(involving suppressing the alerts, but that could affect any other open workbooks, too).Select whatever column you want: