我在Excel中使用VBA。我正在尋找使用VBA複製HTML表格中的某些數據。我與看起來那樣工作表:使用VBA從HTML表複製/粘貼,粘貼到Excel
<table class="RatingsTable standard" id="RatingsTable1">
<tr>
<th class="top_header" colspan="16">General & Fielding Ratings</th>
</tr>
<tr>
<th class="event">Event</th><th class="season">Season</th><th class="height">Height</th><th class="weight">Weight</th><th class="rating overall" title="Overall"><span class="hidden">OV</span></th><th class="rating range" title="Range"><span class="hidden">RA</span></th><th class="rating glove" title="Glove"><span class="hidden">GL</span></th><th class="rating armstrength" title="Arm Strength"><span class="hidden">AS</span></th><th class="rating armaccuracy" title="Arm Accuracy"><span class="hidden">AA</span></th><th class="rating pitchcalling" title="Pitch Calling"><span class="hidden">PC</span></th><th class="rating durability" title="Durability"><span class="hidden">DU</span></th><th class="rating health" title="Health"><span class="hidden">HE</span></th><th class="rating speed" title="Speed"><span class="hidden">SP</span></th><th class="rating patience" title="Patience"><span class="hidden">PA</span></th><th class="rating temper" title="Temper"><span class="hidden">TP</span></th><th class="rating makeup" title="Makeup"><span class="hidden">MK</span></th>
</tr>
<tr class="odd">
<td class="event">Current</td><td class="season">36</td><td class="height">6-0</td><td class="weight">224</td><td>87</td><td>29</td><td>10</td><td>85</td><td>46</td><td>22</td><td>25</td><td>93</td><td>16</td><td>55</td><td>36</td><td>80</td>
</tr>
<tr class="even">
<td class="event">Projected</td><td class="season">-</td><td class="height">?</td><td class="weight">?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td>
</tr>
<tr class="odd">
<td class="event">Spring Training</td><td class="season">36</td><td class="height">6-0</td><td class="weight">224</td><td>87</td><td>29</td><td>10</td><td>85</td><td>46</td><td>22</td><td>25</td><td>93</td><td>16</td><td>55</td><td>36</td><td>80</td>
</tr>
</table>
我期待複製和粘貼的數據是這樣的部分:
<td class="event">Current</td><td class="season">36</td><td class="height">6-0</td><td class="weight">224</td><td>87</td><td>29</td><td>10</td><td>85</td><td>46</td><td>22</td><td>25</td><td>93</td><td>16</td><td>55</td><td>36</td><td>80</td>
所以,我需要複製36,6-0,224, 87,29,10,85,46,22,25,93,16,55,36和80,但我無法抓住這個特定的數據。有人能夠幫助嗎?
這就是我所在的地方,因爲這粘貼了整個表格,我希望能夠獲得更直接的宏觀。使用這種方法,我只能粘貼整個表格,然後從我從網絡上粘貼的內容中複製粘貼。我不知道如何從桌子上選擇。 –
我已根據您的其他意見擴展了答案。如果滿意,請將其標記爲已接受。如果您有更多問題,請將它們分開發布。最好的祝福, –