Chris Williamson
Board Regular
- Joined
- Oct 16, 2010
- Messages
- 83
Hi Guys,
I found part of this code in another topic in these fantastic forums, but I just need a little hand to personalise it a little bit more for what I would like it to do.
This works just fine to insert a new row wherever the selected cell is on the worksheet and then to select cell C2 to finish off.
But what I would like to do is once the new row is inserted, I would like to select whatever the original cell was in the first place.
For example, if cell C10 is selceted, click the button to run this code and for then it to select cell C10 to finish off.
For example, if cell C17 is selceted, click the button to run this code and for then it to select cell C17 to finish off.
So this line of the code "Range("C2").Select" needs to somehow select the original cell that was selected in the first place... any ideas?
Thanks
I found part of this code in another topic in these fantastic forums, but I just need a little hand to personalise it a little bit more for what I would like it to do.
Code:
Sub Insert()
Selection.EntireRow.Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C2").Select
End Sub
This works just fine to insert a new row wherever the selected cell is on the worksheet and then to select cell C2 to finish off.
But what I would like to do is once the new row is inserted, I would like to select whatever the original cell was in the first place.
For example, if cell C10 is selceted, click the button to run this code and for then it to select cell C10 to finish off.
For example, if cell C17 is selceted, click the button to run this code and for then it to select cell C17 to finish off.
So this line of the code "Range("C2").Select" needs to somehow select the original cell that was selected in the first place... any ideas?
Thanks