ChristineJ
Well-known Member
- Joined
- May 18, 2009
- Messages
- 775
- Office Version
- 365
- Platform
- Windows
The following is part of code for a macro I run on different rows in column P. Example: Grading_P(10), Grading_P(22), etc.
I now need to use it on rows in different columns, not just column P. Can this be tweaked so the column letter is also a variable to replace the "P" in the code below?
Example: Grading_P(E15), Grading_P(G21), etc.
I'll still need to use only the row number in specific columns, such as in the last two lines of the code below (columns CD and BZ). Thanks!
I now need to use it on rows in different columns, not just column P. Can this be tweaked so the column letter is also a variable to replace the "P" in the code below?
Example: Grading_P(E15), Grading_P(G21), etc.
I'll still need to use only the row number in specific columns, such as in the last two lines of the code below (columns CD and BZ). Thanks!
Code:
Sub Grading_P(rowNum As Integer)
Dim rowNumber As Integer
rowNumber = rowNum
Range("P" & rowNumber).ClearComments
Range("P" & rowNumber).Offset(0, 1).Value = " " & "X " 'start by setting to X
If IsError(Range("P" & rowNumber)) Then
Range("CD" & rowNumber).Value = "This formula results in an error and cannot be evaluated."
Range("BZ" & rowNumber).Value = 0