I have sourced the below code and removed the source name, do not know if I should do that but rather add back than outright cause an issue.
I cannot merge other code into this code as its clearly beyond my ability. I would like support/ help on how to update to achieve the function in the [] within the code please.
Sub Insert_x()
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Ididntknowwhether tokeepsowentsafe"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.Columns(1)
xLastRow = WorkRng.Rows.Count
Application.ScreenUpdating = False
For xRowIndex = xLastRow To 1 Step -1
Set Rng = WorkRng.Range("A" & xRowIndex)
If Rng.Value = "x" Then [Rather than insert a row if x=1, I would like it to be a range e.g. if x=1 to 3]
Rng.Offset(1, 0).EntireRow.Insert Shift:=xlDown
End If
Next
[I am trying to merge code to highlight the new cell one of 3 colours based on the range in the above query, x=1 to 3]
Application.ScreenUpdating = True
End Sub
If Excel gets itself into a world of confusion I would be ecstatic if it were one row inserted and one colour and I would just create a few macros titled with the needed number.
Thanks guys.
I cannot merge other code into this code as its clearly beyond my ability. I would like support/ help on how to update to achieve the function in the [] within the code please.
Sub Insert_x()
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Ididntknowwhether tokeepsowentsafe"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.Columns(1)
xLastRow = WorkRng.Rows.Count
Application.ScreenUpdating = False
For xRowIndex = xLastRow To 1 Step -1
Set Rng = WorkRng.Range("A" & xRowIndex)
If Rng.Value = "x" Then [Rather than insert a row if x=1, I would like it to be a range e.g. if x=1 to 3]
Rng.Offset(1, 0).EntireRow.Insert Shift:=xlDown
End If
Next
[I am trying to merge code to highlight the new cell one of 3 colours based on the range in the above query, x=1 to 3]
Application.ScreenUpdating = True
End Sub
If Excel gets itself into a world of confusion I would be ecstatic if it were one row inserted and one colour and I would just create a few macros titled with the needed number.
Thanks guys.