例如:
Private Sub UserForm_Initialize()
Dim i%
i = Range("A65536").End(xlUp).Row
Me.ComboBox1.List = Sheet1.Range("A1:A" & i).Value
End Sub作者: arcticfox 時間: 2011-5-17 11:36
錄好的噹案長這樣
Sub 巨集1()
'
' 巨集1 巨集
'
Range("D2").Select
ActiveCell.FormulaR1C1 = "=Sales"
Range("D3").Select
End Sub
然後我把它改到我的模組裡
Sub 專案紀錄() 'Pro_Statu
Dim NewPro As Range
Dim PN As Range
Dim Cus As Range
Dim Sales_P As Range
Dim EnCus As Range
Sales_P.FormulaR1C1 = "=Sales"
With Worksheets("專案紀錄")
Set PN = .Columns(2).Cells.Find(Pro_Statu.Text_PN.Value, LookIn:=xlValues, Lookat:=xlWhole)
Set Cus = .Columns(3).Cells.Find(Pro_Statu.Combo_Cus.Value, LookIn:=xlValues, Lookat:=xlWhole)
Set EnCus = .Columns(12).Cells.Find(Pro_Statu.Text_EnCus.Value, LookIn:=xlValues, Lookat:=xlWhole)
If Not PN Is Nothing And Not Cus Is Nothing And Not EnCus Is Nothing Then
MsgBox "該客戶已開立此案! 如欲修改,請選擇紀錄維護,謝謝.", vbOKOnly + vbExclamation
Pro_Statu.Combo_Cus.SetFocus
Exit Sub
Else