2011-03-15 126 views
0

生成圖表我有在Excel工作表中的一些數據如何從Excel工作表與宏

id           X   Y 
93c3ac0d-5618-42a1-8495-79c890bcc440 3,855860732 3,855888397 
7ba28c26-2a1f-41be-80f0-b0cfae97c504 3,818260653 3,818589846 
a23ace40-c3c3-45cc-ab32-b59e33b7f83b 9,55033235 9,58033235 
013c91b3-bc88-4dbd-ba65-1b02fd093ebb 6,541669914 6,552391904 
afaef874-f52c-4ba2-9565-8bc7facabc93 6,560388448 6,570680712 
35bfd027-147d-4a18-aa1b-217a3593c4b0 8,532138865 8,550715203 
2b7e96d4-8e7b-422b-b07e-0e75378777cd 8,541575561 8,53250362 
d34f7be8-65d1-4c22-b4c7-344db0ba356b 8,542794004 8,545666996 
9430ea31-f8da-43be-9a4f-54cf382aa450 8,557895658 8,522192019 
30d1998a-85b2-456b-81a7-878eafc418f7 9,55033235 9,58033235 
19876333-2120-445e-b1cf-d6f5503c8513 9,55033235 9,58033235 
4831acb3-b9e3-4a4c-9619-c835f6e77ea2 9,55033235 9,52033235 
47bc5691-a6af-4898-b892-da98b56e6f6f 6,54075573 6,544362052 
e4ab1a50-26e5-4f0e-8d62-ab24249125e9 8,5416706 8,5559438 
56e6298e-e05a-433e-8365-a97dba2276df 9,55033235 9,52033235 
f550a46e-139d-4073-a30e-d9c37d807475 9,55033235 9,548071894 
43c667e0-c505-4843-aead-cbfc32bf6ac4 3,828557425 3,828682676 
18f4f9a7-dfba-4e39-8a9d-6e812dbf89f3 6,512208526 6,509076709 
44065b42-342d-42b2-872c-15891cd8e8e6 8,549072661 8,565770097 
dcd8497e-8cb0-4d3b-9f14-d4362cc42e4c 6,545840736 6,570819834 
e7405709-e212-443e-81db-4f57cceca642 9,55033235 9,52033235 
0d639735-175f-4a5d-980a-37032c26cd5f 6,544109632 6,543897064 
30860a47-101e-4fdb-8e9c-33475a140029 3,816656205 3,817036757 
49e58de1-c621-4d52-844a-13b93190e8ce 9,55033235 9,52033235 
c6d085be-dcfd-42de-b084-fbf657c44175 6,545139879 6,544869008 

如何創建宏來處理所有可見的行添加到圖表 現在x和y值系列(GUID)的到點圖(ChartType = xlXYScatter)? 結果圖應放置在新表中並有25個系列。

回答

3

下面的代碼將做的伎倆。 雖然我不知道爲什麼在地球上,你想在一個單獨的系列中的每個點......

Option Explicit 

Sub zonk() 

    Dim i As Long 

    With Charts.Add ' Make new chart 
     ' Set its properties 
     .ChartType = xlXYScatter 
     .Location Where:=xlLocationAsNewSheet 
     .HasLegend = False 

     ' Add the series 
     For i = 1 To 25 
      With .SeriesCollection.NewSeries 
       .XValues = Worksheets("Sheet1").Cells(1 + i, 2) 
       .Values = Worksheets("Sheet1").Cells(1 + i, 3) 
       .Name = Worksheets("Sheet1").Cells(1 + i, 1) 
       ' Assuming your data is at the top left of Sheet1... 
      End With 
     Next i 
    End With 

End Sub 
+0

喜讓·弗朗索瓦·科貝特thanx的幫助。我需要它,因爲 – marcinn 2011-03-16 15:47:18

+5

Ohhhhh,因爲。 – 2011-03-16 16:25:36

+0

...我寫了GSO alghorithm的實現,我想在最後一次迭代中提供代理位置。接下來我想介紹一下代理如何移動,以便一個segemnt呈現一個代理移動。 – marcinn 2011-03-16 19:29:10