So I have created a button that will add multiple rows in a user defined location.
These additional rows correspond to columns in the next sheet, so far so good, although I am not sure I have done it in the most efficient way, it does work.
Now I need the newly created columns to each have a formula in that corresponds to their location and the rows, I have been trying it with a Do While loop but no matter what I change it gets stuck in a loading process and I have to alt+ctrl+del to end task in excel.
This is just the snippet of code that has cause it to stop, I would be happy to give more information if needed.
SheetP = The sheet next to the active sheet.
rowNum = The position number of the corresponding rows
iCountRows = The number of rows being inserted in said position
These additional rows correspond to columns in the next sheet, so far so good, although I am not sure I have done it in the most efficient way, it does work.
Now I need the newly created columns to each have a formula in that corresponds to their location and the rows, I have been trying it with a Do While loop but no matter what I change it gets stuck in a loading process and I have to alt+ctrl+del to end task in excel.
VBA Code:
RefRow = rowNum
RefEx = rowNum + (iCountRows - 1)
colLet = Split(Cells(1, RefRow).Address(True, False), "$")(0)
colLet2 = Split(Cells(1, RefEx).Address(True, False), "$")(0)
Worksheets(SheetN).Columns(colLet & ":" & colLet2).Insert Shift:=xlToRight
LocFrac = rowNum
Do While Cells(36, LocFrac) < iCountRows
LetFrac = Split(Cells(1, LocFrac).Address(True, False), "$")(0)
Worksheets(SheetN).Cells(36, LetFrac).Formula = "=LEFT('" & SheetP & "'!" & LetFrac & "36,(FIND(""/"",'" & SheetP & "'!" & LetFrac & "36,1)-1))+SUM(" & LetFrac & "5:" & LetFrac & "35)&""/""&VLOOKUP(" & LetFrac & "4,Content!$A$1:$F$50,5,FALSE)"
LocFrac = LocFrac + 1
Loop
This is just the snippet of code that has cause it to stop, I would be happy to give more information if needed.
SheetP = The sheet next to the active sheet.
rowNum = The position number of the corresponding rows
iCountRows = The number of rows being inserted in said position