This may seem a little obvious but I am wanting some assistance in modifying some code that is intended to dynamically insert or delete rows in an excel workbook based on a couple of parsed variables which are:
1. Row count - i.e. I already know how many rows to add or delete;
2. Method - i.e. either 1. delete or 2. insert.
My current code is:
Sub delins(uCount As Integer, uMethod As Integer)
'Inserts or deletes a number of given rows based on count and rangename
' = Delete
' = Insert
Dim i As Integer, n As Integer, m As Long, wks As Worksheet
Set wks = ThisWorkbook.Sheets("Test")
Set dCell = Range("testrow")
Do While uCount > 0
n = dCell - 1
m = uRowNumber
If n > 0 Then
Rows(m + 1 & ":" & m + n).Insert
Set dCell = dCell.Offset(n + 1, 0)
Set dCell = dCell.Offset(1, 0)
Essentially, when I call the function, if the method used is to delete, the function will delete x number of rows below the cell containing my range name. In opposite (insert), the function will insert x number of rows below my range name.
Any help appreciated.