Do you want to Create Groupings or Open existing Grouped rows?
To Create a Grouping using variables you almost had the code:
Code:
Sub GroupingTest()
StartRow = 34
EndRow = 38
Rows(StartRow & ":" & EndRow).Group
ActiveSheet.Outline.SummaryRow = xlAbove
End Sub
Note there is no need to Select the row first, just assign the setting in the code.
I like the Outline sign Above the group instead of Below it. Remove the "xlAbove" line if you want the group sign below the grouping.
Once it is set, all Grouping for that sheet is set that way. Other worksheets will remain set to "Below" unless that sheet is also changed.