Hello -
I have a start on a macro but I dont think its working correctly.
On the "OPTIONS" sheet, I want the macro to look in cells E10:E190 for an "X". If found, then lookup the string in A10:A190 (the corresponding row to where the "X" was found), go to the "OPTIONSRANGE" and paste an "X" below that value found. Then, delete that X that was just placed and start on the next row. Thank you in advance!!
I have a start on a macro but I dont think its working correctly.
On the "OPTIONS" sheet, I want the macro to look in cells E10:E190 for an "X". If found, then lookup the string in A10:A190 (the corresponding row to where the "X" was found), go to the "OPTIONSRANGE" and paste an "X" below that value found. Then, delete that X that was just placed and start on the next row. Thank you in advance!!
VBA Code:
Option Explicit
Sub O_bbb()
Const sSht = "OPTIONS"
Const sCell_1 = "A11"
Const sCell_2 = "A12"
Const fSht = "MAIN (OPT_PRICING)"
Const fRng = "OPTIONSRANGE"
Const fMrkr = "X"
Dim fCell As Range
Dim sVle_1, sVle_2
With ActiveWorkbook
sVle_1 = .Sheets(sSht).Range(sCell_1).Value
sVle_2 = .Sheets(sSht).Range(sCell_2).Value
With .Sheets(fSht)
With .Range(fRng)
Set fCell = .Find(sVle_1, , xlFormulas, xlWhole, xlByColumns)
If Not fCell Is Nothing Then fCell.Offset(1, 0).Value = fMrkr
Set fCell = .Find(sVle_2, , xlFormulas, xlWhole, xlByColumns)
If Not fCell Is Nothing Then fCell.Offset(1, 0).Value = fMrkr
End With
End With
End With
End Sub