Dear Sir,
I've got the sheet as in example file. In real life it has more Group (up to 12) and more Categories (up to 64).
My job is inputting into that sheet condionally. I need input number e.g 12 into cells in many categories with the same number and exact Group(one group or more).
I try to prepare the macro to input and it can input one by one categories by Group but Ican't find the way to select many Categories that have the same number to input at one time or I cant put multi input parameters at once. Please help me to code this.
Your help is appreciate!
This is my code:
Sub InputTarpsIntoMBM()
'
Dim rTitle, rNumber, rCongThuc, rAllCells, rLoopCells As Range
Dim myCategory, myVal As String
Dim myNum, myStartGroup, myEndGroup As Integer
Set rAllCells = ActiveSheet.UsedRange
Set rTitle = rAllCells.SpecialCells(xlCellTypeConstants, xlTextValues)
Set rNumber = rAllCells.SpecialCells(xlCellTypeConstants, xlNumbers)
Set rCongThuc = rAllCells.SpecialCells(xlCellTypeFormulas, xlNumbers)
myCategory = Application.InputBox("Enter a Category name e.g: HA. HM in CapsLock")
myVal = Application.InputBox("Enter a Value name e.g: Val1, Val2")
myStartGroup = Application.InputBox("Enter a number of the colum for Sart Group")
myEndGroup = Application.InputBox("Enter a number of the colum for End Group")
myNum = Application.InputBox("Enter a number we want in from StartGroup to End Group")
For Each rLoopCells In rNumber
If (Left(Cells(rLoopCells.Row, 2), 3) = myCategory) And (Right(Cells(rLoopCells.Row, 2), 3) = myVal) Then
If rLoopCells.Column >= myStartGroup And rLoopCells.Column <= myEndGroup Then
rLoopCells.Value = myNum
End If
End If
Next rLoopCells
End Sub
Display More