Jack Farhi
New Member
This is some what of a challenge for me - have been doing VBA for a while so bear with me please. Any help would be appreciated. What i'm trying to do is to take a named range and take 2 values from each row and perform a function. With the value in Column I, i want to paste that to a new row on another sheet and use the value in Column F as the number of times to paste the value from Column I on the other sheet in the adjacent cells (on the same row). For example. if the value in Column F is $95,000 and the value in Column I is 12, then i want to past the $95,000 12 times on the new sheet on a single row in columns A through L. I believe that this is a nested VBA function to handle the read for each of the 2 columns in the sequential rows at the source and then paste the results to the destination sheet and then cycle through again to the next row at the source and paste on the next row at the destination. Here's what i have thus far (far from finished). Any help would be appreciated!!!
I know that this works for a single row from source sheet. I tested it using single cell ranges - just need to cycle through this for each row at the source and to the destination. Ive coded the number of rows at the source from 1 to 20 - just an fyi.
Code:
Sub DeliveryDatesInflowOthers()
'
' DeliveryDatesInflowOthers Macro
'
Application.ScreenUpdating = False
Dim IngCol As Long
Dim i As Integer
Dim n As Integer
IngCol = Range("XCol2")
CleanSlateInflowsOther
NumPMTs = Range("PmtQty")
InflowSpacing = Range("PmtSpacing")
Sheets("Inflows - OTHER").Select
Range("I3").Select
Selection.Copy
Sheets("Cashflow").Select
For n = 1 To 20
Cells(44, IngCol).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
For i = 1 To NumPMTs - 1
ActiveCell.Offset(0, InflowSpacing).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next i
Next n
Sheets("Inflows").Select
Range("A1").Select
Sheets("Cashflow").Select
Range("A1").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
I know that this works for a single row from source sheet. I tested it using single cell ranges - just need to cycle through this for each row at the source and to the destination. Ive coded the number of rows at the source from 1 to 20 - just an fyi.