我目前正在尝试使用VBA解析单元格的内容。这是我的代码:
Sub Button1_Click()
Dim integ As Integer
Dim counter As Range
Dim counts As Integer
Dim num As Integer
num = 2
counts = 0
Dim element As Variant
Dim count As Integer
Dim players(1 To 100) As String
Dim lineup As String
Dim salary As Integer
For Each counter In Range("F2:F11")
starter_letter = "L"
lineup = counter.Value
Dim arr() As String
arr() = Split(lineup)
For Each element In arr
If element = "PG" Or element = "SG" Or element = "SF" Or element = "PF" Or element = "C" Or element = "G" Or element = "F" Or element = "UTIL" Then
counts = counts + 1
Else
players(counts) = players(counts) + element + " "
End If
Next element
For count = 1 To 8
letter = Chr(Asc(starter_letter) + count)
Range(letter + CStr(num)).Value = Trim(players(count))
Next count
num = num + 1
Next counter
End Sub
我将包含图片来说明问题。
我试图从每个单元格中取出名称并将它们分配给不同的单元格。
它适用于我解析的第一个单元格,但计数器不会进入下一个单元格。任何帮助或见解将不胜感激。
以下是每个单元格的内容:
SF Ben Simmons C Marc Gasol PG CJ McCollum F Nicolas Batum PF Enes Kanter G Terry Rozier SG Andrew Harrison UTIL Wayne Selden Jr.
PG Kemba Walker C Marc Gasol G CJ McCollum UTIL Nicolas Batum F Enes Kanter SG Terry Rozier SF Al-Farouq Aminu PF Channing Frye
PG Kemba Walker C Kristaps Porzingis UTIL CJ McCollum SF Nicolas Batum G Terry Rozier F Josh Jackson PF Dirk Nowitzki SG Dwyane Wade
F LeBron James C Marc Gasol UTIL CJ McCollum SF Jaylen Brown SG Terry Rozier G Josh Jackson PG Wayne Selden Jr. PF Marreese Speights
C Dwight Howard PG Kemba Walker SG CJ McCollum PF Enes Kanter F Bobby Portis G Terry Rozier UTIL Wayne Selden Jr. SF Jae Crowder
SF LeBron James PF Al Horford G CJ McCollum C Myles Turner SG Denzel Valentine PG Terry Rozier UTIL Wayne Selden Jr. F Marreese Speights
C Dwight Howard SG CJ McCollum G Elfrid Payton SF Nicolas Batum PF Enes Kanter F Wesley Matthews PG Terry Rozier UTIL Channing Frye
PG Kemba Walker G CJ McCollum UTIL Dennis Smith Jr. SF Brandon Ingram F Enes Kanter C Bobby Portis SG Terry Rozier PF Jarrett Allen
G Kemba Walker F Al Horford UTIL CJ McCollum SG Jordan Clarkson SF Nicolas Batum PG Terry Rozier PF Dirk Nowitzki C Jahlil Okafor
SF LeBron James C Joel Embiid SG Nicolas Batum UTIL Bobby Portis G Terry Rozier PG Wayne Selden Jr. F Jarrett Allen PF Marreese Speights
这些是需要解析的单元格。
这些是当前VBA代码的输出。
答案 0 :(得分:2)
试试这个:
<VirtualHost *:80>
VirtualDocumentRoot "C:/Users/YOUR_USER/Sites/YOUR_PROJECT_FOLDER/%1/markup/"
ServerName sites.YOUR_USER
ServerAlias *.YOUR_USER
<Directory "C:/Users/YOUR_USER/Sites/PROJECT_FOLDER/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>