Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function NumbersToColumns(myCol As Long)
- Dim iA As Long, fA As Long
- If myCol >= 1 And myCol <= 16384 Then
- iA = Int((myCol - 1) / 26)
- fA = Int(IIf(iA - 1 > 0, (iA - 1) / 26, 0))
- NumbersToColumns = IIf(fA > 0, Chr(fA + 64), "") & _
- IIf(iA - fA * 26 > 0, Chr(iA - fA * 26 + 64), "") & _
- Chr(myCol - iA * 26 + 64)
- Else
- NumbersToColumns = False
- End If
- End Function
- Function DeleteElement(x As String, ByRef List() As String) ' As String
- Dim i As Long, el As Long
- Dim result() As String
- ReDim result(UBound(List) - 1)
- For i = 0 To UBound(List)
- If x = List(i) Then
- el = i
- Exit For
- End If
- Next i
- For i = 0 To UBound(result)
- If i < el Then
- result(i) = List(i)
- Else
- result(i) = List(i + 1)
- End If
- Next i
- DeleteElement = result
- End Function
- Function sumSkipper(target As Range, Scell As Long, Snumber As Long)
- 'sumskip1
- 'sumskip(range,starting row, rows to skip) ie.-range b1:b100, 5, 10 will add every 10th cell starting with the 5th row
- Dim Fnumber As Long, answer As Long, a As Long
- Fnumber = target.Rows.Count / Snumber
- For a = 1 To Fnumber
- answer = answer + Cells(Scell, target.Column).Value
- Scell = Scell + Snumber
- Next
- sumSkipper = answer
- End Function
- Sub AddRowsToArr(arr, Optional ByVal nRows As Long = 1, Optional overwrite As Boolean = True)
- 'directions: 'AddRowsToArr myArray3, 1 ---no parenthesis
- 'define arrays of needed row and column numbers
- Dim r, C
- r = Evaluate("row(1:" & CStr(nRows + UBound(arr) - LBound(arr) + 1) & ")")
- C = Application.Transpose(Evaluate("row(1:" & CStr(UBound(arr, 1) - LBound(arr, 1) + 1) & ")"))
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 'redimension array to new size
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- arr = Application.Index(arr, r, C)
- '*) optional overwriting added row elements with Empty ~~> see Note below!
- '...
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement