Hello,
I wonder if somebody can help me please. Is it possible to write a macro that modifies another macro?
What I'm trying to achieve: I have the macro below which moves Textbox2 on row 5 and Textbox1 on row 15 to be directly above the selected cell (code kindly provided by "And the answer Is....", I'm not that clever!). I'd like a second macro that modifies this macro by changing "TextBox1" to "TextBox2" and vice versa in the code to effectively switch the Text Boxes. I've tried the record macro function to get started but no joy! Is there a way of achieving this?
Any help would be very much appreciated.
thank you,
Iain
I wonder if somebody can help me please. Is it possible to write a macro that modifies another macro?
What I'm trying to achieve: I have the macro below which moves Textbox2 on row 5 and Textbox1 on row 15 to be directly above the selected cell (code kindly provided by "And the answer Is....", I'm not that clever!). I'd like a second macro that modifies this macro by changing "TextBox1" to "TextBox2" and vice versa in the code to effectively switch the Text Boxes. I've tried the record macro function to get started but no joy! Is there a way of achieving this?
Any help would be very much appreciated.
thank you,
Iain
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Modified 11/25/2020 8:29:29 AM EST
If Range("A1").Value = False Then
Exit Sub
End If
With TextBox2
.Left = ActiveCell.Left
.Top = Cells(5, 2).Top
End With
With TextBox1
.Left = ActiveCell.Left
.Top = Cells(15, 2).Top
End With
End Sub