View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
poppy poppy is offline
external usenet poster
 
Posts: 1
Default Excel Formula Paste

Hi again

I have taken a snippet of code provided on this board by macropod and
am trying to make it even more simple for my application. Unfortunatle
I'm having some problems.

Problem 1:

Code
-------------------
For i = 3 To 31 Step 2
Columns(i).Value = "%"
Columns(i).HorizontalAlignment = xlCenter
Next

-------------------


This piece of code just makes ALL the values of the chosen columns %.
just want this value to be insert into every second column startin
from the third row of the sheet as headings for that column.

Problem 2:

Code
-------------------

Range("C3:C11,E3,G3,I3,K3,M3,O3").FormulaR1C1 =
"=RC[-1]/SUM(R3C[-1]:R11C[-1])"

-------------------


This code works fine except that when a new month is added, I have t
constantly update the code with the new columns.


Code
-------------------

For i = 3 To 31 Step 2
Columns(i).FormulaR1C1 = "=RC[-1]/SUM(R3C[-1]:R11C[-1])"
Columns(i).NumberFormat = "0%"
Next

-------------------


I have been trying to use the above code instead. This also works fin
except that it overwrites my column headings resulting in "#VALUE!"
The Formula also extends over the last row containing data - resultin
in a long list of unnecessary "0%"

I hope I'm making sense

Looking forward to your input.

Thanx

Kind Regard

--
Message posted from http://www.ExcelForum.com