I have the code below in a macro which seemed to work fine but somehow it manages to convert cells in text format into "?/??" format when the macro is run. This bit relates to the part of the code highlighted in red below... Any questions please ask, this is causing me major problems and need to fix it asap. I've attached a copy of the workbook if it helps. Unfortunately, to run the macro you will need to change the file directory to one that will suit.
Sub save()
'
' save Macro
' Macro recorded 23/11/2006 by Administrator
'
'
Dim cell As Range
Dim rDel As Range
' *********************************
With Sheets("Events")
.Range("A60000", .Cells(.Rows.Count, .Columns.Count)).Delete
.Cells.Copy
End With
Workbooks.Open Filename:="Z:\Baseball\Baseball_Ev.csv"
Range("A1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Set rDel = Nothing
With ActiveSheet.UsedRange
.Value = .Value
For Each cell In Intersect(.Cells, .Columns("A"))
If Len(cell.Text) = 0 Then
If rDel Is Nothing Then Set rDel = cell
Set rDel = Union(rDel, cell)
End If
Next cell
End With
If Not rDel Is Nothing Then rDel.EntireRow.Delete
ActiveWorkbook.Close SaveChanges:=True
' *********************************
With Sheets("Markets")
.Range("A60000", .Cells(.Rows.Count, .Columns.Count)).Delete
.Cells.Copy
End With
Workbooks.Open Filename:="Z:\Baseball\Baseball_Mkt.csv"
Range("A1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Set rDel = Nothing
With ActiveSheet.UsedRange
.Value = .Value
For Each cell In Intersect(.Cells, .Columns("A"))
If Len(cell.Text) = 0 Then
If rDel Is Nothing Then Set rDel = cell
Set rDel = Union(rDel, cell)
End If
Next cell
End With
If Not rDel Is Nothing Then rDel.EntireRow.Delete
ActiveWorkbook.Close SaveChanges:=True
' *********************************
With Sheets("Selections")
.Range("A60000", .Cells(.Rows.Count, .Columns.Count)).Delete
.Cells.Copy
End With
Workbooks.Open Filename:="Z:\Baseball\Baseball_Sel.csv"
Range("A1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Set rDel = Nothing
With ActiveSheet.UsedRange
.Value = .Value
For Each cell In Intersect(.Cells, .Columns("A"))
If Len(cell.Text) = 0 Then
If rDel Is Nothing Then Set rDel = cell
Set rDel = Union(rDel, cell)
End If
Next cell
End With
If Not rDel Is Nothing Then rDel.EntireRow.Delete
ActiveWorkbook.Close SaveChanges:=True
Sheets("Results").Select
Cells.Select
Selection.Copy
Workbooks.Open Filename:="Z:\Baseball\Baseball_Res.csv"
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWorkbook.save
ActiveWorkbook.Close
Sheets("Input").Select
Range("B3").Select
Sheets("Printout Sheet").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Input").Select
Range("B3").Select
End Sub
Bookmarks