excel 報價表單上輸入不同的Item如何帶入不同的圖片
- 帖子
- 44
- 主題
- 13
- 精華
- 0
- 積分
- 70
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-2-19
- 最後登錄
- 2015-10-30
|
22#
發表於 2014-2-26 15:30
| 只看該作者
回復 21# GBKEE
版主你好,我FOB美金的換算想改成=ROUND(總價/美金匯率/毛利率(追加TextBox38),2)
歐元的換算想改成=ROUND(總價/歐元匯率/毛利率(追加TextBox38),2)
下面的程式要如何追加毛利率(追加TextBox38)這各欄位
Private Sub TextBox7_Change() '總價
If Val(Trim(TextBox7)) <> 0 Then
If Val(Trim(TextBox5)) <> 0 And Val(Trim(TextBox36)) = 0 Then TextBox36 = Application.WorksheetFunction.Round(TextBox7 / TextBox5, 2)
'=ROUND(總價/美金匯率/毛利率(追加),2)
If Val(Trim(TextBox6)) <> 0 And Val(Trim(TextBox37)) = 0 Then TextBox37 = Application.WorksheetFunction.Round(TextBox7 / TextBox6, 2)
'=ROUND(總價/美金匯率/毛利率(追加),2)
If Val(Trim(TextBox36)) <> 0 Then TextBox5 = Application.WorksheetFunction.Round(TextBox7 / TextBox36, 2) '總價*美元匯率
If Val(Trim(TextBox37)) <> 0 Then TextBox6 = Application.WorksheetFunction.Round(TextBox7 / TextBox37, 2) '總價*歐元匯率
ElseIf Val(Trim(TextBox7)) = 0 Then
TextBox5 = ""
TextBox6 = ""
End If
If Msg Then 防呆
End Sub
Private Sub TextBox36_Change()
If Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox36)) <> 0 Then
TextBox5 = Application.WorksheetFunction.Round(TextBox7 / TextBox36, 2)
'=ROUND(G2/30,2)
ElseIf Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox5)) <> 0 Then
TextBox5 = TextBox7
End If
End Sub
Private Sub TextBox37_Change()
If Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox37)) <> 0 Then
TextBox6 = Application.WorksheetFunction.Round(TextBox7 / TextBox37, 2)
'=ROUND(G2/40,2)
ElseIf Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox6)) <> 0 Then
TextBox6 = TextBox7
End If
End Sub |
-
-
未命名.JPG
(76.61 KB)
|
|
|
|
|
|
- 帖子
- 44
- 主題
- 13
- 精華
- 0
- 積分
- 70
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-2-19
- 最後登錄
- 2015-10-30
|
23#
發表於 2014-2-26 15:34
| 只看該作者
|
|
|
|
|
|
- 帖子
- 44
- 主題
- 13
- 精華
- 0
- 積分
- 70
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-2-19
- 最後登錄
- 2015-10-30
|
24#
發表於 2014-2-26 18:45
| 只看該作者
回復 21# GBKEE
版主你好,在新增ITEM時只能打數字新增,改成文字時就不能新增
這要如何修改??? |
|
|
|
|
|
|
- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
25#
發表於 2014-2-27 06:48
| 只看該作者
回復 24# h99949
新增ITEM 有規則嗎? |
|
|
|
|
|
|
- 帖子
- 44
- 主題
- 13
- 精華
- 0
- 積分
- 70
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-2-19
- 最後登錄
- 2015-10-30
|
26#
發表於 2014-2-27 09:28
| 只看該作者
回復 25# GBKEE
Sub 防呆() '要給物件類別模組呼叫,不可用 Private
Dim A As Variant, i As Integer, Rng As Range, AR(1 To 2)
CommandButton1.Enabled = False '不可新增
CommandButton2.Enabled = False '不可修改
CommandButton3.Enabled = False '不可刪除
A = Application.Match(Val(ComboBox1), Application.Transpose(ComboBox1.List), 0)
If (IsNumeric(A) And ComboBox1.ListIndex = -1) Or ComboBox1.ListIndex > -1 Then
CommandButton3.Enabled = True '可以刪除
End If
For i = 2 To 35
If i <= 33 Then
If i <= 7 Then AR(1) = AR(1) & "," & Trim(Controls("TextBox" & i))
'Ar(1): 記錄 -> Description,箱,Cuft,FOB-美金,FOB-歐元,總價'在表單的資料
If Controls("TextBox" & i).BackColor = vbRed Then
CommandButton1.Enabled = False '不可新增
CommandButton2.Enabled = False '不可修改
Exit Sub '離開 [防呆]這程式
End If
End If
If IsNumeric(A) Then AR(2) = AR(2) & Trim(Controls("TextBox" & i)) 'Ar(2): 記錄 -> 表單的所有資料
Next
If IsError(A) And IsNumeric(Trim(ComboBox1)) And InStr(AR(1) & ",", ",,") = 0 Then CommandButton1.Enabled = True 是從這裡改嗎?
'IsError(A) :Trim(ComboBox1 不在 ComboBox1.LIST 中, 可以新增
'IsNumeric(Trim(ComboBox1)) 視數字 , 可以新增
'InStr(Ar(1) & ",", ",,") = 0 ->沒有空白 , 可以新增
If IsNumeric(A) And Msg_Data <> AR(2) Then CommandButton2.Enabled = True '可以修改
End Sub |
|
|
|
|
|
|
- 帖子
- 44
- 主題
- 13
- 精華
- 0
- 積分
- 70
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-2-19
- 最後登錄
- 2015-10-30
|
27#
發表於 2014-2-27 14:31
| 只看該作者
回復 25# GBKEE
版主你好,我將IsNumeric (檢查是否為數字)改 IsText這樣不對嗎
If IsError(A) And IsText(Trim(ComboBox1)) And InStr(AR(1) & ",", ",,") = 0 Then CommandButton1.Enabled = True |
|
|
|
|
|
|
- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
28#
發表於 2014-2-27 15:00
| 只看該作者
回復 27# h99949
沒有IsText 這函數
Trim() :清除前後的空白字串
Trim(ComboBox1)<>"" -> 有字串- If IsError(A) And Trim(ComboBox1)<>"" And InStr(AR(1) & ",", ",,") = 0 Then CommandButton1.Enabled = True
複製代碼 |
|
|
|
|
|
|
- 帖子
- 44
- 主題
- 13
- 精華
- 0
- 積分
- 70
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-2-19
- 最後登錄
- 2015-10-30
|
29#
發表於 2014-2-27 16:28
| 只看該作者
回復 28# GBKEE
版主你好,我FOB美金的換算想改成=ROUND(總價/美金匯率/毛利率(追加TextBox38),2)
歐元的換算想改成=ROUND(總價/歐元匯率/毛利率(追加TextBox38),2)
下面程式修改成這樣對嗎?
Private Sub TextBox7_Change() '總價
If Val(Trim(TextBox7)) <> 0 Then
If Val(Trim(TextBox5)) <> 0 And Val(Trim(TextBox36)) = 0 And Val(Trim(TextBox38)) <> 0 Then TextBox36 = Application.WorksheetFunction.Round(TextBox7 / TextBox5 / TextBox38, 2)
If Val(Trim(TextBox5)) <> 0 And Val(Trim(TextBox36)) = 0 And Val(Trim(TextBox38)) <> 0 Then TextBox38 = Application.WorksheetFunction.Round(TextBox7 / TextBox5 / TextBox38, 2)
'=ROUND(總價/美元匯率/毛利率,2)
If Val(Trim(TextBox6)) <> 0 And Val(Trim(TextBox37)) = 0 And Val(Trim(TextBox38)) <> 0 Then TextBox37 = Application.WorksheetFunction.Round(TextBox7 / TextBox6 / TextBox38, 2)
If Val(Trim(TextBox6)) <> 0 And Val(Trim(TextBox37)) = 0 And Val(Trim(TextBox38)) <> 0 Then TextBox38 = Application.WorksheetFunction.Round(TextBox7 / TextBox6 / TextBox38, 2)
'=ROUND(總價/歐元匯率/毛利率,2)
If Val(Trim(TextBox36)) <> 0 Then TextBox5 = Application.WorksheetFunction.Round(TextBox7 / TextBox36 / TextBox38, 2) '總價*美元匯率*毛利率
If Val(Trim(TextBox38)) <> 0 Then TextBox5 = Application.WorksheetFunction.Round(TextBox7 / TextBox36 / TextBox38, 2) '總價*美元匯率*毛利率
If Val(Trim(TextBox37)) <> 0 Then TextBox6 = Application.WorksheetFunction.Round(TextBox7 / TextBox37 / TextBox38, 2) '總價*歐元匯率*毛利率
If Val(Trim(TextBox38)) <> 0 Then TextBox6 = Application.WorksheetFunction.Round(TextBox7 / TextBox37 / TextBox38, 2) '總價*歐元匯率*毛利率
ElseIf Val(Trim(TextBox7)) = 0 Then
TextBox5 = ""
TextBox6 = ""
End If
If Msg Then 防呆
End Sub
Private Sub TextBox36_Change()
If Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox36)) <> 0 Then
TextBox5 = Application.WorksheetFunction.Round(TextBox7 / TextBox36, 2)
'=ROUND(總價/美元匯率/毛利率,2)
ElseIf Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox5)) <> 0 Then
TextBox5 = TextBox7
End If
End Sub
Private Sub TextBox37_Change()
If Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox37)) <> 0 Then
TextBox6 = Application.WorksheetFunction.Round(TextBox7 / TextBox37, 2)
'=ROUND(總價/歐元匯率/毛利率,2)
ElseIf Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox6)) <> 0 Then
TextBox6 = TextBox7
End If
End Sub
Private Sub TextBox38_Change()
If Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox36)) <> 0 And Val(Trim(TextBox38)) <> 0 Then
TextBox5 = Application.WorksheetFunction.Round(TextBox7 / TextBox36 / TextBox38, 2)
'=ROUND(總價/美元匯率/毛利率,2)
ElseIf Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox5)) <> 0 Then
TextBox5 = TextBox7
End If
If Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox37)) <> 0 And Val(Trim(TextBox38)) <> 0 Then
TextBox6 = Application.WorksheetFunction.Round(TextBox7 / TextBox37 / TextBox38, 2)
'=ROUND(總價/歐元匯率/毛利率,2)
ElseIf Val(Trim(TextBox7)) <> 0 And Val(Trim(TextBox6)) <> 0 Then
TextBox6 = TextBox7
End If
End Sub |
-
-
未命名.JPG
(76.61 KB)
|
|
|
|
|
|