|
基本
各位高手来看看, 我逻辑意图是
1,记录每个月各项费用
2,选择哪项费用,寻找每个月的空位,然后输入费用。
可是我发现我不能用 "For Each locate In Range("place & count" : "place & max")"
可能 Place一般是字母 例如 For each locate in range ("A & count": "A & max")
请问有没有各位大神知道如何解决这个问题?
Sub Button2_Click()Dim kind As String
Dim month As Integer
Dim place As String
Dim count As Integer
Dim amou As Integer
Dim locate As Range
Dim max As Integer
kind = InputBox("please enter the first letter of expense name?")
month = Val(InputBox("which month of data you want to input?"))
count = (month - 1) * 40 + 2
max = count + 40
If kind = "p" Then (代表 purchase)
place = A
ElseIf kind = "m" Then (代表 Marketing)
place = F
ElseIf kind = "r" Then (代表 Room)
place = G
End If
For Each locate In Range("place & count" : "place & max")
amout = Val(InputBox("Please enter the amount of the expense"))
amout.offset(1,0)=val(inputbox("please enter the amount of HST"))
amout.offset(2,0)=amout-amout.offset(1, 0)
Next
"""""
或者换成
Sub Button2_Click()Dim kind As String
Dim month As Integer
Dim place As String
Dim count As Integer
Dim amou As Integer
Dim locate As Range
kind = InputBox("please enter the first letter of expense name?")
month = Val(InputBox("which month of data you want to input?"))
row_number = 0
If kind = "p" Then (代表 purchase)
place = A
ElseIf kind = "m" Then (代表 Marketing)
place = F
ElseIf kind = "r" Then (代表 Room)
place = G
End If
Do
Doevents
row_number=row_number+1
item_in_review=sheet1.range(Kind & row_number)
loop until item_in_review=""
amout =range(kind & row_number)= Val(InputBox("Please enter the amount of the expense"))
amout.offset(1,0)=val(inputbox("please enter the amount of HST"))
amout.offset(2,0)=amout-amout.offset(1, 0)
End Sub
|
|