Hi All,
How can I adapt the code below to start running this procedure from whichever cell I select. The code below works great in column three (just as I asked it to do). The problem is that at times I have multiple columns and would like to run this in any one of my columns.
Oh yeah, please note: I am running this macro from a 'Button' and do not want to have to physically change the code every time I run it.
Any help is much appreciated!
Sub Macro1()
'
' Macro1 Macro
'
x = 1
Do
ActiveSheet.Cells(x, 3).Activate
If ActiveSheet.Cells(x, 3) = "" Then
ActiveCell.FormulaR1C1 = "=+AVERAGE(R[-4]C[-1]:RC[-1])"
Selection.Offset(0, 0) = "Name"
Else
End If
x = x + 5
Loop Until ActiveSheet.Cells(x, 1) = ""
End Sub
How can I adapt the code below to start running this procedure from whichever cell I select. The code below works great in column three (just as I asked it to do). The problem is that at times I have multiple columns and would like to run this in any one of my columns.
Oh yeah, please note: I am running this macro from a 'Button' and do not want to have to physically change the code every time I run it.
Any help is much appreciated!
Sub Macro1()
'
' Macro1 Macro
'
x = 1
Do
ActiveSheet.Cells(x, 3).Activate
If ActiveSheet.Cells(x, 3) = "" Then
ActiveCell.FormulaR1C1 = "=+AVERAGE(R[-4]C[-1]:RC[-1])"
Selection.Offset(0, 0) = "Name"
Else
End If
x = x + 5
Loop Until ActiveSheet.Cells(x, 1) = ""
End Sub