View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default help with generating a percentage value

Hi John,

Am Tue, 13 Mar 2012 05:38:07 -0700 (PDT) schrieb
:

the code loops through the cells picking up the values and adding a
percentage, until it comes to the end of the list


every third column is empty? Then try:

Dim LCol As Long
Dim i As Long

LCol = Cells(9, Columns.Count).End(xlToLeft).Column + 1
For i = 9 To LCol Step 3
Cells(9, i) = Cells(9, i - 1) / Cells(9, i - 2) * 100
Next

or:

Dim LCol As Long
Dim i As Long

LCol = Cells(9, Columns.Count).End(xlToLeft).Column + 1
For i = 9 To LCol Step 3
Cells(9, i) = Cells(9, i - 1) / Cells(9, i - 2)
Cells(9, i).NumberFormat = "0.00%"
Next


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2