saboh12617
Board Regular
- Joined
- May 31, 2024
- Messages
- 142
- Office Version
- 365
- Platform
- Windows
Hello,
I feel very clueless because i wrote this simple Macro but i can not run it (F5/F8). The compiler however signals no error:
For information Total1 is a Worksheet, "tblFiles9" a structured table, and "GetGenericName" a simple function that poses no problem in other subs (it just returns a string concatenation).
Did i use a incompatible variable name? Thanks you in advance for any advices.
I feel very clueless because i wrote this simple Macro but i can not run it (F5/F8). The compiler however signals no error:
For information Total1 is a Worksheet, "tblFiles9" a structured table, and "GetGenericName" a simple function that poses no problem in other subs (it just returns a string concatenation).
Did i use a incompatible variable name? Thanks you in advance for any advices.
VBA Code:
Public Sub UGN()
' 1 reference to "Total" sheet for generic values to use
'
Dim i As Long, countI As Long
Dim newNames() As String
ReDim newNames(1 To 15, 1 To 1)
With Total1.ListObjects("tblFiles9").DataBodyRange
For i = 1 To .Rows.count
If .Cells(i, 1).Value2 Then
countI = countI + 1
With Total1.Range("f5:f8")
newNames(i, 1) = GetGenericName( _
.Cells(1, 1).Value2, _
.Cells(2, 1).Value2, _
.Cells(3, 1).Value2, _
.Cells(4, 1).Value2 _
) & Format(countI, "-000")
End With
End If
Next i
End With
End Sub