mscallisto
Technical User
I'm trying to position to the last used row in a sheet.
In the following code I can never get the correct syntax of this line:
Range("strTheEnd & Str(intLastRow)").Select
In the following code I can never get the correct syntax of this line:
Range("strTheEnd & Str(intLastRow)").Select
Code:
Sub colorval()
Dim strTheEnd As String
Dim intLastRow As Integer
intLastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
strTheEnd = "A"
For Ii = 2 To intLastRow ' Skip Header Row
' Rows(Ii).Columns(12) = Rows(Ii).Columns(1).Font.ColorIndex
Rows(Ii).Columns(12) = Rows(Ii).Columns(1).Interior.ColorIndex
' I want (Blue ColorIndex 5)to sort before (Red ColorIndex 3)
If Rows(Ii).Columns(12) = 3 Then
Rows(Ii).Columns(12) = 6
End If
Next Ii
Cells.Select
Selection.Sort Key1:=Range("L2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'example of what I'm trying to do
'Range("A & Ii").Select
Range("strTheEnd & Str(intLastRow)").Select
End Sub