I'm using Excel 2003 and have copied values from Sheet1 to Sheet2, Sheet3... Sheet.
If a value is a date on I need to keep the date format on all sheets. (MM/DD/YY HH:MM:SS)
If the values is 0,1 or 2 I need to keep the values as is.
If it's any other number I need it to be NumberFormat = "0.0".
I'm trying to use a for loop and a Select case for this scenario, but I think I'm missing a line of code.
Error message is "Compile Error: Next without For"
Here's my code:
<CODE>
Public Sub format_sheets()
Dim i As Integer
Dim ws As Worksheet
Dim c As Range
For Each ws In ActiveWorkbook.Worksheets
For Each c In ws.UsedRange
Select Case c.value
Case IsDate(c.value) = True
c.value = c.value
Case 0, 1, 2
c.NumberFormat = "0"
Case Else
c.NumberFormat = "0.0"
Next c
Next ws
End Sub
</CODE>
Any help would be great
If a value is a date on I need to keep the date format on all sheets. (MM/DD/YY HH:MM:SS)
If the values is 0,1 or 2 I need to keep the values as is.
If it's any other number I need it to be NumberFormat = "0.0".
I'm trying to use a for loop and a Select case for this scenario, but I think I'm missing a line of code.
Error message is "Compile Error: Next without For"
Here's my code:
<CODE>
Public Sub format_sheets()
Dim i As Integer
Dim ws As Worksheet
Dim c As Range
For Each ws In ActiveWorkbook.Worksheets
For Each c In ws.UsedRange
Select Case c.value
Case IsDate(c.value) = True
c.value = c.value
Case 0, 1, 2
c.NumberFormat = "0"
Case Else
c.NumberFormat = "0.0"
Next c
Next ws
End Sub
</CODE>
Any help would be great