LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Pank
 
Posts: n/a
Default 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.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"