回復 8#GBKEE
前輩!非常謝謝指導...
良師!謝謝!原來如此!殆勢啦!又來一題
照你的指導畫葫蘆還是畫不出來
登入程式實在沒辦法
寫入程式勉強可以執行
執行結果如動畫所示
請再指導真的感恩謝謝再三!!
Sub 登入()
With Sheets("學習")
ag:
ZZ = Application.InputBox("請在B欄中選取資料", "資料登入", Type:=2)
If ZZ = "" Then Selection = "": End
If ZZ = False Then Selection = "": End
.Range("N" & Rows.Count).End(xlUp)(2, 1).Select
ActiveCell = ZZ: ActiveCell.Offset(0, 1) = [C5]
' 如果選取並非B欄資料 Then MsgBox "選取的資料並非B欄所有!!請重新選取": GoTo ag
ag1:
ZZ = Application.InputBox("請在B欄中選取資料", "資料登入", Type:=1)
If ZZ = False Then 寫入: End
.Range("N" & Rows.Count).End(xlUp)(2, 1).Select
ActiveCell = ZZ: ActiveCell.Offset(0, 1) = [C7]
' 如果選取並非B欄資料 Then MsgBox "選取的資料並非B欄所有!!請重新選取": GoTo ag1
GoTo ag1
End With
End Sub
Sub 寫入()
Dim Rng As Range
ag:
With Sheets("學習")
Set Rng = Sheets("學習").Range("U" & Rows.Count).End(xlUp)(2, 1)
ZZ = Application.InputBox("請輸入數字", "數字", Type:=1)
If ZZ <= 0 Then GoTo ag
With Rng.Cells(1, -4)
.Value = ZZ
.NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 "
.Font.ColorIndex = 10
End With
End With
With Sheets("學習")
Set Rng = Sheets("學習").Range("N" & Rows.Count).End(xlUp)(1, 1)
With Rng.Cells(1, 1)
For Each R In Array(8)
With .Cells(1, R)
.FormulaR1C1 = Cells(3, .Column).FormulaR1C1
If R = 8 Then
.Font.ColorIndex = 7
.NumberFormatLocal = "0.00%"
End If
End With
Next
End With
Set Rng = Sheets("學習").Range("N" & Rows.Count).End(xlUp)(2, 1)
With Rng.Cells(1, 1)
For Each e In Array(1, 2, 3, 4, 5, 6, 8)
With .Cells(1, e)
.FormulaR1C1 = Cells(4, .Column).FormulaR1C1
If e = 1 Then
.Font.ColorIndex = 1
ElseIf e = 3 Then
.Value = Date
.NumberFormat = "e/m/d"
.Font.ColorIndex = 5
ElseIf e = 8 Then
.Value = Date
.NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 "
End If
End With
Next
End With
With Sheets("學習")
Set Rng = Sheets("學習").Range("N" & Rows.Count).End(xlUp)(1, 1)
ZZ = Application.InputBox("請輸入數據", "數據", Type:=1)
If ZZ <= 0 Then Exit Sub
With Rng.Cells(1, 7)
.Value = ZZ
End With
End With
.Columns("N:U").EntireColumn.AutoFit
End With
End Sub作者: GBKEE 時間: 2012-10-28 20:45