早上好,
我最近被任命为更新和监视我当前公司存在的任何VBA问题的人员,因为这样做的前任员工已经离开,并且没有立即计划雇用替代人员的计划。不幸的是,我的excel和VBA技能基本都没有礼貌,而youtube只能提供很多帮助。
其中一个电子表格中使用了一个宏,该宏可以检查并覆盖某些月末数字。宏的这一部分运行良好,当为每个客户端完成此操作时,应将X输入到列M(完成完成)以表示已完成。 N列(标为“跳过”)已经用X填充了由于个别客户的技术而应跳过的X。
但是,在执行客户端检查时,宏似乎在N列中填充了x值。有人遇到过类似的问题,即错误地将值分配给了相邻列吗?
Sub Values()
Application.ScreenUpdating = False
Dim EndRow As Integer
Dim i As Integer
Dim ValueDate As Date
Dim Cash As Double
Dim Value As Double
Dim APXRef As String
Dim d As Integer
Dim Overwrite As Boolean
Overwrite = Worksheets("Summary").Range("Y2").Value ' from checkboxes
EndRow = Range("J2").End(xlDown).Row
ValueDate = Range("P6").Value
If MsgBox("You are uploading with the following date: " & ValueDate & ", do
you want to continue?", vbYesNo) = vbNo Then Exit Sub
For i = 2 To EndRow
APXRef = Range("J" & i).Value
Value = Range("L" & i).Value
If Range("M" & i) = "" And Range("N" & i) = "" Then
Worksheets("Summary").Activate
r = Range("A:A").Find(APXRef).Row
Range("B" & r).Select
Call GoToClient
d = Range("A10").End(xlDown).Row
If Range("A" & d).Value < ValueDate Then
Range("A" & d + 1).Value = ValueDate
Range("B" & d + 1).Value = Value
Range("D" & d + 1).FormulaR1C1 = "=((RC[-2]/(R[-1]C[-2]+RC[-1]))-1)*100"
Range("E" & d + 1).FormulaR1C1 = "=((((R[-1]C)*(RC[-1]))/100)+R[-1]C)"
Range("H" & d + 1).Value = Range("H" & d).Value
'Save client
If Overwrite = True Then
Call SaveClient
End If
'Return to Flow Tab
Worksheets("Flows").Activate
Range("M" & i).Value = "x"
Else
'skip
Worksheets("Flows").Activate
Range("N" & i).Value = "x"
End If
End If
Application.StatusBar = TabRef & " " & Round(((i - 1) / (EndRow - 1)) *
100, 1) & "% Complete"
Next i
Application.StatusBar = "Value Update Complete"
End Sub