braindiesel
Well-known Member
- Joined
- Mar 16, 2009
- Messages
- 571
- Office Version
- 365
- 2019
- 2010
- Platform
- Windows
I have the following code working as part of a macro without any issue... of course, when I get to my client, I get a debug error...
The topRow and botRow variables are storing numbers and in debug mode, when I hover over them, the correct numbers are showing.
Any thoughts on a better way to write this or am I missing something?
ActiveWorkbook.Worksheets("REPORT5").Sort.SortFields.Add2 Key:=Range( _
"D" & topRow & ":D" & botrow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("REPORT5").Sort.SortFields.Add2 Key:=Range( _
"E" & topRow & ":E" & botrow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
The topRow and botRow variables are storing numbers and in debug mode, when I hover over them, the correct numbers are showing.
Any thoughts on a better way to write this or am I missing something?
ActiveWorkbook.Worksheets("REPORT5").Sort.SortFields.Add2 Key:=Range( _
"D" & topRow & ":D" & botrow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("REPORT5").Sort.SortFields.Add2 Key:=Range( _
"E" & topRow & ":E" & botrow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal