I am creating a function in my macro to check to see if the value of a cell's 2nd digit is equivalent to some number. Say check if it is a 2 so 1234, 4244, 5255, x2xx all would work, then if so I want to insert a column there. Is this possible?
![]() |
I am creating a function in my macro to check to see if the value of a cell's 2nd digit is equivalent to some number. Say check if it is a 2 so 1234, 4244, 5255, x2xx all would work, then if so I want to insert a column there. Is this possible?
This little macro will evaluate the ACTIVECELL. You can adapt this for your uses, I imagine:
Code:Sub CheckDigit()
Dim MyVal As Boolean
MyVal = Mid(ActiveCell, 2, 1) = 2
If MyVal = True Then ActiveCell.EntireColumn.Insert (xlShiftToRight)
End Sub
Excellent. Thanks!
All times are GMT -7. The time now is 05:13 AM. |