0
あなたのお手伝いをよろしくお願いします!Windows XPでOS日付を変更するマクロをExcel
Excel(2010)VBAのマスターシート(下のコード)の作業項目の完了日を更新するマクロを構築しました。しかし、私がマクロを実行するたびに、マクロがマスターシートに置かれた日付にOS(Windows XP)の日付が変更されています。
たとえば、マスターシートで12/1/2018の更新をテストしているときに、タスクバーの日付が12/1/2018に変更され、12/1までのカレンダーの毎回の定期会議のカレンダー通知が届きました/ 2018
私のコードがOSの日付にどのように影響しているかわかりませんが、本当に助けていただければ幸いです。ありがとうございます!
Sub UploadComplete()
'Uploads the date marker at contract on master
'Set up the array Contracts which will house the new contracts to be uploaded
Dim Contracts() As String
Dim size As Integer
Dim N As Integer
Dim R As Integer
'This sets up the value for N as the number (namely the row number) at the end of the
N = Worksheets("Master").Cells(Rows.Count, "A").End(xlUp).Row + 1
'Identifies which column to add the marker to
R = Application.WorksheetFunction.VLookup(Range("F2"), Worksheets("Update").Range("E14:G263"), 3, False)
'Determine size of array and store it into variable size
size = WorksheetFunction.CountA(Worksheets("Update").Columns(1))
'Having counted size can redim the array
ReDim Contracts(size)
'Insert the values in column A into the array
Dim i As Integer
For i = 1 To size
Contracts(i) = Worksheets("Update").Range("A1").Offset(i)
Next i
'Takes each value in the array and adds it to the end of the master list using N
For i = LBound(Contracts) To UBound(Contracts)
Worksheets("Master").Range("A" & N).Value = Contracts(i)
N = N + 1
Next i
'Remove the duplicates from the master tab based on the first column namely
'column A
Worksheets("Master").Range("A1:ZZ1000000").RemoveDuplicates Columns:=Array(1)
'Remove blank rows from Master
Dim rng As Range
Set rng = Worksheets("Master").Range("A1:A1000000").SpecialCells(xlCellTypeBlanks)
rng.EntireRow.Delete
'Find the contract from the imput grab the terminated date and put it into the master
For i = LBound(Contracts) To UBound(Contracts)
If Contracts(i) <> "" Then
Set rgFound = Worksheets("Update").Range("A2:A1000000").Find(Contracts(i), , , xlWhole)
Date = rgFound.Offset(, 1).Value
Set rgFill = Worksheets("Master").Range("A:A").Find(Contracts(i))
rgFill.Offset(, R) = Format(Date, "mm/dd/yyy")
rgFill.Offset(, R).Value = Date '?CHANGING DATE ON OS?
End If
Next i
'Remove blank rows from Master
Set rng = Worksheets("Master").Range("A1:A1000000").SpecialCells(xlCellTypeBlanks)
rng.EntireRow.Delete
End Sub
実現しているべき日は、関数であった私は、変数としてそれを使用しようとしていました。手伝ってくれてどうもありがとう!!! –
[OPTION EXPLICIT](https://msdn.microsoft.com/en-us/library/y9341s4f.aspx)をご覧ください。これは、このような問題を回避するのに役立ちます。 – TmTron