Results 1 to 7 of 7

Macro changing text to "?/??" format???

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Macro changing text to "?/??" format???

    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
    Attached Files Attached Files
    Last edited by adam2308; 09-16-2009 at 09:14 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1