View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stan Scott Stan Scott is offline
external usenet poster
 
Posts: 34
Default inserting a column to the right

Bryan,

This should work for you:

Sub InsertColumnEnterFormula()
Dim myCell As Range
Set myCell = Cells.Find("AZoriginal")
With myCell
.Offset(, 1).EntireColumn.Insert
.Offset(2 - .Row, 1).FormulaR1C1 = "=IF(RC[-1]<0,RC[-1]+360,RC[-1])"
End With
End Sub

Stan Scott
New York City

"Bryan Kelly" wrote in message
. ..
I need to insert a column in two ways.
First, I need to find a column by searching for the text "AZoriginal",

then
insert a column to the right named "AZ". I will need to add this formula

to
row 2 of that new column

if ( x2 < 0, x2 + 360, x2 )

where x is the column where "AZoriginal" was found. Actually I need to

copy
the formula down to the bottom row but I have another macro that I think I
can use as a template and acomplish that.


Second I need to add a new column to the far right end of the data. Then

I
will insert another formula. Once I see the first and how to add a column
to the far right, I should be able to figure out the rest.

--
Thank you,
Bryan Kelly
Time is the medium we use to express out priorities.