Я хочу показать имя листа, которое соответствует слову, начинающемуся с "x" или "3" в массиве, как это, но теперь показывает только последнее.
WshtNames = Array ("X310361", "X310377 "," X310379 "," X310400 "," 310531 "," 310539 "," X310561 "," X310579 "," X310605 "," 310610 "," 310645 "," 310646 "," 310647 "," 310653 ", "X310660", "X310662", "310665")
Sub MultiSheetArray()
'allows you to store an array of sheets
Dim ws As Worksheet
Dim shtArray() As String
Dim intA As Integer
Dim intB As Integer
' First you need to enter the sheet names into an array
For Each ws In ActiveWorkbook.Worksheets
If LCase(Left(ws.Name, 1)) = "x" Or Left(ws.Name, 1) = "3" Then
intA = intA + 1
ReDim Preserve shtArray(intA)
shtArray(intA) = ws.Name
End If
Next ws
' Now list the sheets we entered into our array "shtArray"
Debug.Print shtArray(intA)
End Sub
https://i.stack.imgur.com/9fhc3.png