I have 4 queries built into a spreadsheet. There is a lot of manipulations that happen after that. I have figured out how to loop and use the selection.offset to be able to handle the different sizes of data. The first 4 loops work just fine. The fifth loop, that I had to write a function for skips the last line, which creates stair-steps of blank cells throughout the rest of the calculations, making my data unreliable. Please help! The fourth loop, fith loop and the function I created are below.
'4 concatenate 3ltr plcd and sub for vlookup and sums
range("J1").Select
ActiveCell.FormulaR1C1 = "Con"
range("J3").Select
Do Until Selection.Offset(0, -1).Value = ""
Selection.Value = Selection.Offset(0, -3).Value & Selection.Offset(0, -2).Value & Selection.Offset(0, -1).Value
Selection.Offset(1, 0).Select
Loop
'5 =sumif 3ltr, plcd, and sub matches, sum cost
Do Until Selection.Offset(0, -1).Value = ""
Selection.Value = ColumnS
Selection.Offset(1, 0).Select
Loop
Function ColumnS()
Dim X As Integer 'what row are you staring in?
Dim LR As Long 'last row
LR = ActiveSheet.range("G65536").End(xlUp).Row
For X = 3 To LR
Cells(X, 19).Value = "=sumif(J:J,J" & X & ",Q:Q)"
Next X
End Function
Any help would be greatly appreciated!
'4 concatenate 3ltr plcd and sub for vlookup and sums
range("J1").Select
ActiveCell.FormulaR1C1 = "Con"
range("J3").Select
Do Until Selection.Offset(0, -1).Value = ""
Selection.Value = Selection.Offset(0, -3).Value & Selection.Offset(0, -2).Value & Selection.Offset(0, -1).Value
Selection.Offset(1, 0).Select
Loop
'5 =sumif 3ltr, plcd, and sub matches, sum cost
Do Until Selection.Offset(0, -1).Value = ""
Selection.Value = ColumnS
Selection.Offset(1, 0).Select
Loop
Function ColumnS()
Dim X As Integer 'what row are you staring in?
Dim LR As Long 'last row
LR = ActiveSheet.range("G65536").End(xlUp).Row
For X = 3 To LR
Cells(X, 19).Value = "=sumif(J:J,J" & X & ",Q:Q)"
Next X
End Function
Any help would be greatly appreciated!