返回列表 上一主題 發帖

[發問] 此巨集如何寫??

回復 2# t8899
  1. Sub TEST1()
  2.    
  3.     firstaddress = ""
  4.     With Selection
  5.         If .Cells(1, 1) = "" Then
  6.             firstaddress = .Cells(1, 1).Address
  7.             lastAddress = firstaddress
  8.         End If
  9.         Set c = .Find("", LookIn:=xlValues)
  10.         If Not c Is Nothing Then
  11.             If firstaddress = "" Then
  12.                 firstaddress = c.Address
  13.             End If
  14.             lastAddress = firstaddress
  15.             Do
  16.                 Set c = .FindNext(c)
  17.                 If Not c Is Nothing And c.Address <> firstaddress Then
  18.                     lastAddress = c.Address
  19.                 End If
  20.             Loop While Not c Is Nothing And c.Address <> firstaddress
  21.         End If
  22.     End With
  23.     MsgBox (lastAddress)
  24. End Sub
複製代碼
懂得發問,答案就會在其中

今日の一秒は  明日にない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

        靜思自在 : 唯其尊重自己的人,才更勇於縮小自己。
返回列表 上一主題