DELETE FORMULES

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
How can I whrite a macro that delete all the formules in column B (+/- 7000 lines)without deleted the values in the column?
Many thanks.
 
On 2002-03-26 16:38, Amds wrote:
On 2002-03-26 15:52, verluc wrote:
On 2002-03-26 15:43, Barrie Davidson wrote:
Here is the complete macro,who is in my program:Sub Copy()
Sheets("Portefeuille").Select
Range("IV1").End(xlToLeft).Offset(0, -1).EntireColumn.Insert
Range(Range("IV1").End(xlToLeft).Address, _
Range("IV1").End(xlToLeft).End(xlDown). _
Address).Copy
Range("IV1").End(xlToLeft).Offset(0, -1).PasteSpecial _
Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
End Sub

It is on the first Range("IV1") that I receive the error.
Many thanks

Do you have anything in cell B1? I'm betting not; if you only have something in cell A1, the macro is trying to go to the left of cell A1.

Range("IV1").End(xlToLeft).Offset(0, -1)

This code will go to the column left of the rightmost column of data in row 1. For example, if your rightmost cell is C1, it will go to cell B1. As you can see, you will get an error if your rightmost cell (in row 1) is A1.

Am I correct?

Great, It works.Many,Many thanks.


Re the line that reads :-
Range("IV1").End(xlToLeft).Offset(0, -1).EntireColumn.Insert

Should this not be :-
Range("IV1").End(xlToLeft)).EntireColumn.Insert


The complete code could be simplified to :-

With Sheets("Portefeuille").Range("IV1").End(xlToLeft).EntireColumn
.Insert
.Offset(0, -1) = .Value
End With
O.K.This macro works perfect.But still one question about insert row.
Is it possible that the row that will be insert each time the same row is ex.Row C
and that all the other rows change one row to the right.So I can follow each day the evolution of the stock market.
Thanks
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Not sure I understand what you want.

Check whether this does it :-

With Sheets("Portefeuille").Columns(3)
.Insert
.Offset(0, -1) = Columns(2).Value
End With
 
Upvote 0
On 2002-03-27 05:34, Abcd wrote:
Not sure I understand what you want.

Check whether this does it :-

With Sheets("Portefeuille").Columns(3)
.Insert
.Offset(0, -1) = Columns(2).Value
End With
Yes,that's what I mean.
Many thanks.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top