Oberon70
Board Regular
- Joined
- Jan 21, 2022
- Messages
- 160
- Office Version
- 365
- Platform
- Windows
Hi,
I am still trying to get my head around arrays, but it is slow going.
I am wanting to add a row to an array when the reference number is 8 characters long.
I am still trying to get my head around arrays, but it is slow going.
I am wanting to add a row to an array when the reference number is 8 characters long.
VBA Code:
Sub Macro1 ()
Dim wb As Workbook
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim i As Double
Dim LastRow As Double
Dim lo As ListObject
Dim loClm As ListColumn
Dim rng As Range
Dim TBLArray()
Dim RowNum As Double
Set wb = ThisWorkbook
Set ws2 = wb.Sheets("Receipting")
Set lo = ws2.ListObjects("Table3")
LastRow = ws2.Cells.SpecialCells(xlCellTypeLastCell).Row
With ws2.Range("f1")
.EntireColumn.Insert
.EntireColumn.NumberFormat = "0.00"
End With
ws2.Range("F1").Value = "Inc Comm"
Set loClm = lo.ListColumns("Inc Comm")
Set rng = loClm.DataBodyRange
rng.FormulaR1C1 = "=RC4+RC5"
For i = 2 To LastRow
RowNum = ws2.Cells(i, 1).Row
If Len(ws2.Cells(i, 1)) = 8 Then TBLArray() = ws2.Cells(i, 1).Row
Next i
End Sub