Hi there,
I am trying to add rows depending on a cell value in a column. Basically I have a column with either 1 or 0 as the value. I would like a to add a row where each cell value is 1. I have searched the forum and have found this from another post with a similar problem however I have only a basic understanding of vba see code below.
The problem that I am trying to solve is adding up column cell values and I would like to split the data by row when a whole number of 1 reached ie.
0.5
0.25
0.25
(Add row here)
1
(Add row here)
0.5
0.5
(Add row here)
1
(Add row here) etc
I have tried to make things simpler by adding up these up as running totals (ie putting a value in G2 and then =(G2+C3) and then creating the 1's and 0's on whole numbers ie (=if(G2=INT(G2),"1","0"). If there's an answer to split the row either way I would be very happy for any help. Thanks!
sub AddBlankRows()
'
dim iRow as integer
range("a1").select
'
irow=1
'
do
'
if cells(irow+1, 1)<>cells(irow,1) then
cells(irow+1,1).entirerow.insert shift:=xldown
irow=irow+2
else
irow=irow+1
end if
'
loop while not cells (irow,1).text=""
'
end sub
Bookmarks