View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Loop returns only one value, does not loop & an assignment tocolumn how-to problem.

On Wednesday, April 3, 2013 9:51:22 AM UTC-7, GS wrote:
See below to know what code is new and where it inserts in the existing

sub...



<existing lines

If Not wks Is wksTarget Then


lLastRow = wks.Cells(wks.Rows.Count, "K").End(xlUp).Row




<insert 1 line here

iPos = 1 '//initialize RowHeight trigger



<existing lines

For Each rng In wks.Range("K2:K" & lLastRow)


If Not rng.Value = 1 Then


lNextRow = lNextRow + 1


With wksTarget




<insert 3 lines here

'Set RowHeight for the 1st row of each wks data.

'then reset the trigger to skip subsequent rows.

If iPos 0 Then .Rows(lNextRow).RowHeight = 24: iPos

= 0



..where the entire snippet was intended to replace existing 6 lines via

copy/paste because those existing lines are within the snippet.



--

Garry



Free usenet access at http://www.eternal-september.org

Classic VB Users Regroup!

comp.lang.basic.visual.misc

microsoft.public.vb.general.discussion


Okay, thanks I will give that a go.

I have to admit a gross error om my part releative to the dispersal of the "Product A, B, C" etc across sheet 1. Instead of that text being dispersed, it is the actual number in column K that needs to be dispersed.

So I'm pretty sure this is the heart of the "split and deal to the correct columns on sheet 1", taking the right most value from the C row entry using the key from above and all, to get it to the correct column/row. I just need it to disperse the Column K values to where the Column C values are going.

For n = LBound(vPrds) To UBound(vPrds)
vP = Split(vPrds(n), ":")
If Right(wks.Cells(rng.Row, "C"), 1) = vP(0) Then
.Cells(lNextRow, vP(1)) = wks.Cells(rng.Row, "C")
Exit For
End If
Next 'n

My Bad... I apologize.

Howard