[ASP ] 執行錯誤438已刪文
執行巨集出現錯誤代碼438
內容如下,錯誤的地方為紅底部分,請各位幫忙看一下問題,謝謝。
Sub RandomSampleSelection()
Range("Z1").Select
ActiveCell.FormulaR1C1 = "Random"
Range("Z2").Select
ActiveCell.FormulaR1C1 = "=RAND()"
Range("Z2").Select
Selection.AutoFill Destination:=Range("Z2:Z" & Range("A" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=-54
Cells.Select
ActiveWorkbook.Worksheets("Random Sample Selection").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Random Sample Selection").Sort.SortFields.Add2 Key:=Range("Z2:Z" & Range("A" & Rows.Count).End(xlUp).Row) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Random Sample Selection").Sort
.SetRange Range("A:AA")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Dim myInputBoxVariable As Integer
myInputBoxVariable = InputBox(Prompt:="How many rows?", Title:="Trim Data", Default:="1")
myInputBoxVariable = myInputBoxVariable + 2
Rows(myInputBoxVariable & ":100000").Select
Selection.Delete Shift:=xlUp
Columns("Z:Z").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
End Sub
Best Regards,
Chieh Lin 林潔
保德信人壽整合支援部
TEL:(02)2767-8866 #2503
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.137.54.151 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1564547073.A.D39.html
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章