Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Converting formula to value and deleting rows using macros.
I have a header, variable number of data lines and a trailer.
On the trailer in cell Bn I have the formula =COUNTROWS(B:B) €“ 2. I need to delete all the data lines and therefore I need a mechanism to convert the formula to a physical value. I have tried the following code:- With wks lLastRow = Range("B1").End(xlDown).Row Selection.NumberFormat = "General" Selection.Copy .Range(lLastRow).Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False End With But unfortunately I get the message €˜run-time error 44. Debug points to ..Range(lLastRow).Select Additionally I need to delete all data records (i.e. from Row 2 to lLastRow = Range("B1").End(xlDown) €“ 1). How do I code that? Any help appreciated. |