我正在考虑在Excel中制作一个时间轴,根据日期在时间轴上移动一个“窗口”(白色椭圆)。
我正在做的是VBA:
我对VBA完全不熟悉,并且想知道是否有人能指出我正确的方向?
谢谢!
答案 0 :(得分:0)
...试
Sub Macro1()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Type = 1 Then
shp.Delete
End If
Next shp
ActiveSheet.Shapes.AddShape Type:=msoShapeOvalCallout, Left:=100, Top:=100, Width:=200, Height:=150
ActiveSheet.Shapes(1).TextFrame2.TextRange.Characters.Text = "Hello people!"
Application.ScreenUpdating = True
Application.Wait (Now + TimeValue("00:00:03"))
For i = 1 To 25 Step 1
ActiveSheet.Shapes(1).IncrementLeft -4
ActiveSheet.Shapes(1).IncrementTop i
Application.Wait (Now + 0.000009)
Next i
End Sub
答案 1 :(得分:0)
怎么样?
Sub Macro1()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Type = 1 Then
shp.Delete
End If
Next shp
If ActiveSheet.Range("A1").Value = 1 Then
ActiveSheet.Shapes.AddShape Type:=msoShapeOvalCallout, Left:=100, Top:=0, Width:=200, Height:=150
End If
If ActiveSheet.Range("A1").Value = 2 Then
ActiveSheet.Shapes.AddShape Type:=msoShapeOvalCallout, Left:=100, Top:=50, Width:=200, Height:=150
End If
'and so on...
End Sub