●EXCEL・VBA質問スレ Part2●at TECH
●EXCEL・VBA質問スレ Part2● - 暇つぶし2ch78:デフォルトの名無しさん
07/06/01 14:15:30
>>76
どっちの整理番号を残すとかは考えずにいきます.
このスレ的には問題あるかもしれないけど,一応動くので.
Private Sub Sample()
Dim targetCell As Range
Dim date1 As Date,date2 As Date,date3 As Date
Dim intervalMin As Integer

Set targetCell = Range("B1")  ←最初に日付が入っているセル
Do Until targetCell.Cells(2,1)=""
 date1=targetCell+CDate(targetCell.Cells(1,2))
 date2=targetCell.Cells(2,1)+CDate(targetCell.Cells(2,2))
 interval = DatePart("n",date2-date1)
 If interval=0 Then
  Rows(targetCell.Cells(2,1).Row).Delete
  ElseIf interval>10 Then
   Rows(targetCell.Cells(2,1).Row).Insert
   date3=DateAdd("n",10,date1)
   targetCell.Cells(2,1)=Format(date3,"yyyy/M/d")
   targetCell.Cells(2,2)=Format(date3,"hh:mm")
 End If
 Set targetCell=targetCell.Cells(2,1)
Loop
End Sub


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch