我需要连接一个字母,同时将选定的单元格除以一个常数
I need to CONCATENATE a letter while dividing selected cells by a constant
我有一些数据块,其中块中的某些数据应用了 10 的倍数。我需要删除 10 的倍数并将 "A" 添加到相同的单元格。数据介于两组范围之间。
记录的代码
Sub FixShaded()
'
' FixShaded Macro
Range("H2766").Select
ActiveCell.FormulaR1C1 = "=""A""&(RC[-6]/10)"
Range("H2766").Select
Selection.AutoFill Destination:=Range("H2766:H2770"),
Type:=xlFillDefault
Range("H2766:H2770").Select
Selection.Copy
Range("B2766").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("H2766:H2770").Select
Application.CutCopyMode = False
Selection.ClearContents
End Sub
我正在尝试开始工作的代码
Sub findRange()
Dim WorkRng As Range
Dim cell As Range
Const CL As Long = 10
Dim sht As Worksheet
Set sht = ActiveSheet
Dim i As Long
Set WorkRng = Application.Intersect(Selection, ActiveSheet.UsedRange)
For Each cell In WorkRng
If WorkRng > 150 And WorkRng < 1000 Then
WorkRng.Value = WorkRng.Value / CL
End If
If WorkRng > 20000 And WorkRng < 250000 Then
WorkRng.Value = WorkRng.Value / CL
End If
Next
End Sub
抱歉,我只有 3 个月的时间 VBA 并正在尝试 谢谢
像这样的东西应该可以工作
For Each cell In WorkRng.Cells
With cell
If (.Value > 150 And .Value < 1000) Or _
(.Value > 20000 And .Value < 250000) Then
.Value = "A" & .Value / CL
End If
End with
Next
我有一些数据块,其中块中的某些数据应用了 10 的倍数。我需要删除 10 的倍数并将 "A" 添加到相同的单元格。数据介于两组范围之间。
记录的代码
Sub FixShaded()
'
' FixShaded Macro
Range("H2766").Select
ActiveCell.FormulaR1C1 = "=""A""&(RC[-6]/10)"
Range("H2766").Select
Selection.AutoFill Destination:=Range("H2766:H2770"),
Type:=xlFillDefault
Range("H2766:H2770").Select
Selection.Copy
Range("B2766").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("H2766:H2770").Select
Application.CutCopyMode = False
Selection.ClearContents
End Sub
我正在尝试开始工作的代码
Sub findRange()
Dim WorkRng As Range
Dim cell As Range
Const CL As Long = 10
Dim sht As Worksheet
Set sht = ActiveSheet
Dim i As Long
Set WorkRng = Application.Intersect(Selection, ActiveSheet.UsedRange)
For Each cell In WorkRng
If WorkRng > 150 And WorkRng < 1000 Then
WorkRng.Value = WorkRng.Value / CL
End If
If WorkRng > 20000 And WorkRng < 250000 Then
WorkRng.Value = WorkRng.Value / CL
End If
Next
End Sub
抱歉,我只有 3 个月的时间 VBA 并正在尝试 谢谢
像这样的东西应该可以工作
For Each cell In WorkRng.Cells
With cell
If (.Value > 150 And .Value < 1000) Or _
(.Value > 20000 And .Value < 250000) Then
.Value = "A" & .Value / CL
End If
End with
Next