I am looking to use a loop to populate the next column and am difficulties. The only way I am able to get it to work is to just past a new column each time, but that is making the order of the looping go backwards. Is there a way to move through columns and not have to insert a column? Any help is greatly appreciated. TIA
Here is the code:
VB Code:
'lets loop While dTempStart < dEnd 'create a new column for the data Sheets("Setup").Select Columns("F:F").Select Selection.Insert Shift:=xlToRight 'plug the dates into the worksheet Worksheets("Setup").Range("C3").Value = dTempStart Worksheets("Setup").Range("C4").Value = dTempEnd 'put worksheet output into the new column Sheets("Setup").Select Columns("C:C").Select Selection.Copy Columns("F:F").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False Columns("C:C").Select Application.CutCopyMode = False Range("E11").Select 'setup for next iteration of the loop dTempStart = dTempEnd + 1 dTempEnd = dTempEnd + interval - 1 Wend




Reply With Quote