0% found this document useful (0 votes)
18 views7 pages

Sub AutoCreate

This macro automates the processing of change requests in a system by iterating through rows of data in a worksheet and performing the following actions for each row: retrieving data values from the row, positioning the cursor, entering values, and clicking buttons to complete the change request process in the system. It records the start and end time of running the macro. Temporary sheets are created and deleted as needed during the processing.

Uploaded by

jplay1208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views7 pages

Sub AutoCreate

This macro automates the processing of change requests in a system by iterating through rows of data in a worksheet and performing the following actions for each row: retrieving data values from the row, positioning the cursor, entering values, and clicking buttons to complete the change request process in the system. It records the start and end time of running the macro. Temporary sheets are created and deleted as needed during the processing.

Uploaded by

jplay1208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Sub AutoCreate_DX_INVI24() '珇腹アら戳ミ 20230908

Application.DisplayAlerts = False
Dim myWS As Worksheet
Const ToleranceDay As Variant = 3
Set myWS = ThisWorkbook.Sheets("公夹 Г 夹砞竚")

ProcessNameX = myWS.[G3].Value '祘嘿


ProcessNameY = myWS.[H3].Value
RegionX = myWS.[G4].Value '跋丁匡拒
RegionY = myWS.[H4].Value
ChangeX = myWS.[G5].Value '跑匡拒
ChangeY = myWS.[H5].Value
PickX = myWS.[G6].Value '┰匡拒
PickY = myWS.[H6].Value
PNX = myWS.[G7].Value '珇腹
PNY = myWS.[H7].Value
SheetNumX = myWS.[G8].Value '跑虫
SheetNumY = myWS.[H8].Value
RemarkX = myWS.[G9].Value '称猔
RemarkY = myWS.[H9].Value
AdvanceItemX = myWS.[G10].Value '秈顶匡兜
AdvanceItemY = myWS.[H10].Value
DateExpireX = myWS.[G11].Value 'アら戳
DateExpireY = myWS.[H11].Value
ConfirmX = myWS.[G12].Value '絋粄
ConfirmY = myWS.[H12].Value
ServerOKX = myWS.[G13].Value '狝叭竟絋粄
ServerOKY = myWS.[H13].Value
ScopeX = myWS.[G15].Value '琩高
ScopeY = myWS.[H15].Value

ShiftX = myWS.[G14].Value '簿


ShiftY = myWS.[H14].Value
TempA1X = myWS.[G16].Value 'TempA1
TempA1Y = myWS.[H16].Value
'*************************
'盢公夹簿55
SetCursorPos 5, 5
DoEvents
Response = MsgBox("公夹琌オà", vbYesNo Or vbDefaultButton1)
If Response = vbYes Then
' Continue
Else ' Escape
GoTo end_step:
End If
'盢公夹簿19051065
SetCursorPos 1905, 1065
DoEvents
Response = MsgBox("公夹琌à", vbYesNo Or vbDefaultButton1)
If Response = vbYes Then
' 矗ボ逆抖
MsgBox ("DX 祘 Α 穓碝块オà1/3Excelオà2/3 ぃ璶が綛咀" &
Chr(10) & "盢块猭ち传璣ゅ")
Else
' Escape
GoTo end_step:
End If

'癘魁秨﹍丁
Worksheets("跑戈").Range("A1").Value = Time
If Worksheets(1).Name = "Temp" Then
'ぃノヴ矪瞶
Else
'穝糤 Temp
Sheets.Add before:=Sheets(1)
Sheets(1).Name = "Temp"
End If
Worksheets("Temp").Range("A1").NumberFormat = "@"
Worksheets("Temp").Columns("A").ColumnWidth = 70
Worksheets("Temp").Rows(1).RowHeight = 400
Worksheets("跑戈").AutoFilterMode = False
MaxDataRow = Worksheets("跑戈").Cells(Rows.Count, 3).End(xlUp).Row
'秨﹍硋掸秈︽戈蝴臔
For RowVal = 2582 To MaxDataRow
'穝糤虫
SetCursorPos ProcessNameX, ProcessNameY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
'块BOMB02
Application.SendKeys "BOMB02" '块祘 Α嘿
DoEvents
Sleep 50
SetCursorPos ScopeX, ScopeY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 1000

'絋粄穝糤块Θ
PNval = Worksheets("跑戈").Cells(RowVal, 3).Value
Counter = 0
Do While Counter < 5 And GetPNVal <> PNval
Counter = Counter + 1
'块珇腹
SetCursorPos PNX, PNY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
Call オ龄
DoEvents
SetCursorPos PNX + ShiftX, PNY
DoEvents
Sleep 50
Call 秨オ龄
DoEvents
Sleep 50
Application.SendKeys PNval '块PN
DoEvents
Sleep 50

'弄PN 戈
SetCursorPos PNX, PNY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
Call オ龄
DoEvents
SetCursorPos PNX + ShiftX, PNY
DoEvents
Sleep 50
Call 秨オ龄
DoEvents
Sleep 50
Application.SendKeys ("^c") '狡籹珇腹
DoEvents
Sleep 100
'耞芭禟茂ず甧琌フ
ClipFormat = Excel.Application.ClipboardFormats
If UBound(ClipFormat) = 1 And ClipFormat(1) = -1 Then
'芭禟茂礚ず甧
Worksheets("Temp").Range("A1").Value = "0"
GetPNVal = "0"
Else
Worksheets("Temp").Select
Worksheets("Temp").Range("A1").Select
SetCursorPos TempA1X, TempA1Y
DoEvents
Call 虫阑
DoEvents
Sleep 50
Worksheets("Temp").Paste '狡籹珇腹
GetPNVal = Worksheets("Temp").Range("A1").Value
GetPNVal = CStr(GetPNVal)
End If
Set ClipFormat = Nothing

If Counter = 5 Then
'穝糤ア毖既氨
Stop
End If
Sleep 500
Loop

'跋丁砞﹚
SetCursorPos RegionX, RegionY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
'跑匡拒
SetCursorPos ChangeX, ChangeY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
'匡拒跑よ Α
SetCursorPos PickX, PickY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
'块跑虫
SetCursorPos SheetNumX, SheetNumY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
Application.SendKeys "4101"
DoEvents
Sleep 50
'块称猔
SetCursorPos RemarkX, RemarkY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
Application.SendKeys "AutoBOMCHG"
DoEvents
Sleep 50
'匡拒秈顶匡兜
SetCursorPos AdvanceItemX, AdvanceItemY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
'块アら戳
SetCursorPos DateExpireX, DateExpireY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
DateVal = Worksheets("跑戈").Cells(RowVal, 6).Value
YYval = Left(DateVal, 4)
MMval = Mid(DateVal, 6, 2)
DDval = Right(DateVal, 2)
Application.SendKeys YYval
DoEvents
Sleep 50
Application.SendKeys MMval
DoEvents
Sleep 50
Application.SendKeys DDval
DoEvents
Sleep 50
'絋粄跑
SetCursorPos ConfirmX, ConfirmY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 50
'絋粄狝叭竟跑
SetCursorPos ServerOKX, ServerOKY
DoEvents
Sleep 50
Call 虫阑
DoEvents
Sleep 500
NextItem:
Worksheets("跑戈").Select
Worksheets("跑戈").Range("G" & RowVal).Select
Worksheets("跑戈").Range("G" & RowVal).Value = "OK"
Next
end_step:
Worksheets("公夹 Г 夹砞竚").Select
'癘魁 ЧΘ丁
Worksheets("跑戈").Range("B1").Value = Time
Worksheets("Temp").Delete
ActiveWorkbook.Save
End Sub

You might also like