FJSeminario
New Member
- Joined
- Mar 26, 2011
- Messages
- 12
I want to be able to select a range of rows to sort, but I don't know the
number of rows in the Sheet, so I find out programmatically first and then
move to the Range object Frm_sortRange01
I am getting a type mistmatch where it is indicated by the Comment
on the right of the statement
Option Explicit
Option Base 1
Dim GeoCodeTableStartRow As Integer
Dim Frm_SortRange01 As Range
GeoCodeTableStartRow = 2
Set Frm_SortRange01 = Range("2:48") ' <===== Is this correct?
ThisWorkbook.Activate
Sheets("GeoCodeTable").Activate
Sheets("GeoCodeTable").Select
' I got this code from recording a Macro in Excel Changed code to automate Original Code
' Changed Code ---------------------------- Original Code
Rows(Frm_SortRange01).Select ' <----------- Rows("2:48").Select
Application.CutCopyMode = False
Selection.Sort Key1:= _
Range("A" & GeoCodeTableStartRow), _ ' <---- Range("A2"),
Order1:=xlAscending, Key2:= _
Range("C" & GeoCodeTableStartRow) _ ' <----- Range("C48"),
, Order2:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
<input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden">
number of rows in the Sheet, so I find out programmatically first and then
move to the Range object Frm_sortRange01
I am getting a type mistmatch where it is indicated by the Comment
on the right of the statement
Option Explicit
Option Base 1
Dim GeoCodeTableStartRow As Integer
Dim Frm_SortRange01 As Range
GeoCodeTableStartRow = 2
Set Frm_SortRange01 = Range("2:48") ' <===== Is this correct?
ThisWorkbook.Activate
Sheets("GeoCodeTable").Activate
Sheets("GeoCodeTable").Select
' I got this code from recording a Macro in Excel Changed code to automate Original Code
' Changed Code ---------------------------- Original Code
Rows(Frm_SortRange01).Select ' <----------- Rows("2:48").Select
Application.CutCopyMode = False
Selection.Sort Key1:= _
Range("A" & GeoCodeTableStartRow), _ ' <---- Range("A2"),
Order1:=xlAscending, Key2:= _
Range("C" & GeoCodeTableStartRow) _ ' <----- Range("C48"),
, Order2:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
<input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="if(typeof(jsCall)=='function'){jsCall();}else{setTimeout('jsCall()',500);}" id="jsProxy" type="hidden">
Last edited: