I'm using Excel 2003 and my code is supposed to delete the calculations leaving just the values. Everything seems to be working like it should 'till the code is supposed to delete the original data rows / columns:
The code deletes the rows and never gets to the columns-part. I tried adding MsgBox between the rows just to see if it's the Columns-part that's "crashing" the code but the code never got that far.
I tried to code to another workbook and everything went smoothly. Tried running the code from the other workbook to this one and it never got to the Columns-part. Tried swithing the row order and still only the first row completes.
There are a few named ranges in the the ranges the code is supposed to delete. Could this be causing the problems? The rest of the cells to be deleted are just values used in formulas in the range that I'm trying to move closer to A1 but the formulas are already converted to values when the code gets this far.
Is this a known bug or is there just something wrong with my workbook? And how could I get around it?
Here's the whole thing:
Code:
Rows("1:67").Delete Shift:=xlUp
Columns("A:AJ").Delete Shift:=xlToLeft
I tried to code to another workbook and everything went smoothly. Tried running the code from the other workbook to this one and it never got to the Columns-part. Tried swithing the row order and still only the first row completes.
There are a few named ranges in the the ranges the code is supposed to delete. Could this be causing the problems? The rest of the cells to be deleted are just values used in formulas in the range that I'm trying to move closer to A1 but the formulas are already converted to values when the code gets this far.
Is this a known bug or is there just something wrong with my workbook? And how could I get around it?
Here's the whole thing:
Code:
Sub ValuesOnly()
Dim SH As Shape
Dim Alue As Range
Dim Rng As Range
'Delete macro buttons:
For Each SH In ActiveSheet.Shapes
SH.Delete
Next SH
'Convert formulas to values:
With Range("AK:BM")
.Value = .Value
End With
'Delete the extra rows and columns:
Rows("1:67").Delete Shift:=xlUp
Columns("A:AJ").Delete Shift:=xlToLeft
End Sub